[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: commit: ldap/libraries/liblber io.c

I wrote:
> No.  From POSIX, IEEE Std 1003.1 of 2004, susv3/functions/errno.html:
>    "The value of errno should only be examined when it is indicated to
>    be valid by a function's return value. (...)  The setting of errno
>    after a successful call to a function is unspecified unless the
>    description of that function specifies that errno shall not be
>    modified."

BTW, the change history says this is new in the 2004 edition.  I'm
guessing that was done to reflect existing practice.  Pre-POSIX errno
was an utter mess, but the growing conformance to various standards like
POSIX has at least imporved and clarified the situation.

Though the same page also says
    "An application that needs to examine the value of errno to
    determine the error should set it to 0 before a function call, then
    inspect it before a subsequent function call."
Not quite sure what that means.  Maybe a holdover from an earlier
version?  Certainly it's safer for functions that are not required to
set errno, or when writing for OSes using different standards (or not
yet properly supporting any standard but their own).