sys_nerr

Joerg Schilling schilling at fokus.gmd.de
Wed Feb 6 12:31:12 PST 2002


>From: "Wichmann, Mats D" <mats.d.wichmann at intel.com>

>> >> Call strerror() and check if it returns a NULL pointer.
>> 
>> >sterror doesn't return NULL; it returns "Unknown error x" if 
>> >you call it with an out-of-range x. 
>> 
>> Looks like you found a broken strerror() implementation.

>Eh?  Even the SUS wording indicates that there's no return
>value reserved to indicate an error.  It does describe a way 
>to test for failure, however, by mucking with errno.

You  are right, it is not very specifc.

>The behavior on a standard Linux system (glibc 2.2) is as
>described above on invalid errnos:  "Unknown error x".

Which is illegal according to SUSv3.

SUSv3 requires that strerror() is thread-safe, so it cannot
return a modified string.

A conforming implementation may either behave like on SYSv
since 1988and return NULL or return a constant string.

Jörg

 EMail:joerg at schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js at cs.tu-berlin.de		(uni)  If you don't have iso-8859-1
       schilling at fokus.gmd.de		(work) chars I am J"org Schilling
 URL:  http://www.fokus.gmd.de/usr/schilling   ftp://ftp.fokus.gmd.de/pub/unix




More information about the lsb-discuss mailing list