On Tue, May 07, 2013 at 03:25:04PM +0200, Remco wrote:
| The way I read the man page on my OpenBSD 5.2 system, as well as on the
| www.openbsd.org web site, errno has no specific meaning when getpwuid
| returns. It only tells you whether it succeeded or not, it doesn't say it
| sets errno, nor does it provide a clear way to determine why the function
| didn't succeed. (however, if you're right the man page may be lacking)
Where do you see that ? errno is not used to tell you wether a call
succeeded or not. If a call did not succeed, errno would get set. If
a call was successful, it never sets errno.
>From intro(2) (get there via the errno(2) mlink):
When a system call detects an error, it returns an
integer value indicating failure (usually -1) and
sets the variable errno accordingly. (This allows
interpretation of the failure on receiving a -1
and to take action accordingly.) Successful calls
never set errno; once set, it remains until
another error occurs. It should only be examined
after an error.
This is how errno should behave across the entire system. If you find
a case where this is not true, please report it.
Paul 'WEiRD' de Weerd
--
>++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
http://www.weirdnet.nl/