Subject: Re: getpw*_r standards
To: John Nemeth <email@example.com>
From: Nathan J. Williams <firstname.lastname@example.org>
Date: 04/10/2005 18:01:01
email@example.com (John Nemeth) writes:
> Any POSIX gurus here? I'm wondering about standards compliance.
> The POSIX definition of getpwnam_r is located here:
> At the above URL, there are no error codes listed that can be used to
> indicate the entry wasn't found.
The getpwnam() function shall return a pointer to a struct passwd
with the structure as defined in <pwd.h> with a matching entry if
found. A null pointer shall be returned if the requested entry is
not found, or an error occurs. On error, errno shall be set to
indicate the error.
That second sentence says to me that "entry not found" is not an
error, so we're wrong, and that Solaris is doing the right thing. The
rest of the standards text seems to back up that idea - the bit about
having to set errno in advance if you want to check for an error is
key, since it indicates that returning-NULL-but-not-setting-errno is