tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: strerror(0) POSIX compliance



jklowden%schemamania.org@localhost ("James K. Lowden") writes:

>> Well, if calling strerror(0) is a bug, then usually because it's
>> called after an error condition that didn't set errno.

>Has that happened to you?  I feel sure that's never happened to me, but
>maybe I'm less adventurous.  

Happened all the time when people use the getent-like functions
and then call perror() when they fail.


>IMO it's incorrect to say 0 is an "undefined error".  It's defined as
>success by nearly every syscall.

No syscall will ever set errno to 0.


>	Success: it is not an error to call strerror with 0.  

Means that strerror(0) should not set errno=EINVAL. Doesn't
say anything about the returned string.


-- 
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index