>Rob> Indeed. You *MUST* be able to store a zero [at least] into "errno",
>Rob> because the Unix kernel does *NOT* clear it on success, and there are
>Rob> some system calls which *can* return "-1" on success! If you could
>Rob> not store a zero into errno, you would have *no* way to tell if those
>Rob> system calls failed.
Every system call that I'm aware of either has a special return value which
indicates whether it failed (which is usually -1), or modifies an argument
appropriately, or has some other kind of indication of failure. Even
exec(2), which shouldn't return *at all* unless there was a failure, makes
a point of returning -1. What exceptions do you know of?
(On the other hand, even on systems which do magic with errno to make it
threadsafe, I have not yet encountered a case where errno was not a
modifiable lvalue. Where is this not the case? Some specific examples of
nonportability, instead of vague handwaving, would be nice.)