Subject: Re: getpw*_r standards
To: Klaus Klein <kleink@mibh.de>
From: Luke Mewburn <lukem@NetBSD.org>
List: current-users
Date: 04/11/2005 10:40:37
--+QmoJrblcRudFCJH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Sun, Apr 10, 2005 at 10:49:48PM +0200, Klaus Klein wrote:
| > Should NetBSD code follow the Solaris way for maximum
| > portability?
|=20
| The issue here is that the standard does distinguish between
| "successfully no entry found" and "an error caused no entry to be
| found", viz. "A NULL pointer shall be returned at the location pointed
| to by result on error _or_ if the requested entry is not found"
| (getpwnam_r, emphasis added by me). Its wording is less concise
| for getpwnam, but comparing -current against 2.0 shows a regression
| in now setting errno to ENOENT in the former case.
Please be more explicit, as it's unclear to me the context of
"in the former case".
2.0 doesn't have getpwnam_r().
3 and -current do.
AFAICT, Klaus & Nathan are recommending that getpwnam_r():
* return 0 and set result to NULL for "notfound", and
* return errno (!0) and set result to NULL for "error".
If I have understood that correctly, we can change get{pw,gr}*_r()
to do this.
2.0's getpwnam() returns NULL in both the "not found" and "error"
case, and in both cases errno is indeterminately set depending
on what the back-end modules (files, nis, dns, ...) do.
-current's getpwnam() has the same behaviour.
| So yes, we should change the implementation, including the result
| pointer location being set to NULL in the error (non-zero return)
| case.
Once I understand exactly what you're asking to change,
I'll change it ;-)
Cheers,
Luke.
--+QmoJrblcRudFCJH
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)
iD8DBQFCWceFpBhtmn8zJHIRAoXEAJ93ypVf96loeHNMCOtLKaE4SmiepQCfaKOK
ZNXua1bpMpKjs8y3rvO2FK0=
=iEvi
-----END PGP SIGNATURE-----
--+QmoJrblcRudFCJH--