On Tue, 18 Feb 2014, Ingo Schwarze wrote:
> > Index: gen/getpwent.c
> > ===================================================================
> > RCS file: /cvs/src/lib/libc/gen/getpwent.c,v
> > retrieving revision 1.48
> > diff -u -p -r1.48 getpwent.c
> > --- gen/getpwent.c 15 Nov 2013 22:32:55 -0000 1.48
> > +++ gen/getpwent.c 6 Feb 2014 00:15:46 -0000
> > @@ -672,8 +672,11 @@ _pwhashbyname(const char *name, char *bu
> > int r;
> >
> > len = strlen(name);
> > - if (len > _PW_NAME_LEN)
> > + if (len > _PW_NAME_LEN) {
> > + /* can't be present, so just treat as "no match" */
> > + errno = 0;
> > return (NULL);
> > + }
>
> That code is correct, your change makes it incorrect.
If that change is left out then this change:
> > if (pwretp)
> > *pwretp = pwret;
> > _THREAD_PRIVATE_MUTEX_UNLOCK(pw);
> > - return (pwret ? 0 : 1);
> > + return (pwret ? 0 : errno);
> > }
...cannot possibly be correct.