Re: sys_nerr and strerror()

From: Jens-S. Voeckler <voeckler@dont-contact.us>
Date: Tue, 27 Jul 1999 09:03:04 +0200

On Tue, 27 Jul 1999, David Luyer wrote:

]> undefined, Up to the implementation.
]
]BTW, on Linux:
]
]typhaon; cat blah.c
]main() { extern int errno; printf("%s\n", strerror(666)); printf("%d\n", errno); }
]typhaon; make blah
]cc blah.c -o blah
]typhaon; ./blah
]Unknown error 666
]0
]typhaon;
]
]So not everyone returns NULL on unknown errno values

if it returns something defined like "unknown", that is perfectly o.k. But
some implementations return 0, which is a little hard to printf, if your
printf doesn't do 0 pointer checks.

]or sets errno on errors.

I would *not* expect to set errno with strerror(), nor would I expect
strerror() to reset errno - I would expect them to be at least black-box
independent. IMHO errno should not be touched during strerror(), thus
Henrik's suggestion sounded good.

Le deagh dhùrachd,
Dipl.-Ing. Jens-S. Vöckler (voeckler@rvs.uni-hannover.de)
Institute for Computer Networks and Distributed Systems
University of Hanover, Germany; +49 511 762 4726
Received on Tue Jul 29 2003 - 13:15:59 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:16 MST