tech-userlevel archive

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

Re: strerror(0) POSIX compliance



On Thu, Mar 24, 2016 at 05:09:50PM +0000, Christos Zoulas wrote:
> Actually not; syscalls set errno on error, don't clear errno on success [1].
> Thus it is incorrect code to test errno if the syscall succeeded. It shows
> nothing, try:

Actually, it is even worse. errno is essentially *undefined* after
successful calls. It only ever has a well defined value after a failing
operation. This is most noticable with things like stdio, were
intermediate failures can be handled without resetting errno.

Joerg


Home | Main Index | Thread Index | Old Index