Subject: Re: getpw*_r standards
To: Luke Mewburn <>
From: Klaus Klein <>
List: current-users
Date: 04/19/2005 01:36:15
Luke Mewburn wrote:

> 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.

That's correct as far as I'm concerned.

> 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.

I tried my little experiment in a simple files back-end environment
only (I didn't have any other 2.0 setup at hand, but OTOH that
configuration is what one would expect to be as close as it can
still get to "traditional" behavior given code reuse in the
back-end). However, the spec applies the same way here: There
should be no "error" indication (as in touching errno) for
"notfound".  But given nsdispatch()'s callback return values it
should be easy to distinguish between that and "error", shouldn't

> Once I understand exactly what you're asking to change,
> I'll change it ;-)

Well, I hope this improved our situation a bit. :-)

- Klaus