Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bad configure test for getpwent() ?
- X-seq: zsh-workers 8531
 
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
 
- To: Clint Adams <schizo@xxxxxxxxxx>
 
- Subject: Re: Bad configure test for getpwent() ?
 
- Date: Wed, 3 Nov 1999 20:14:14 +0000
 
- Cc: zsh-workers@xxxxxxxxxxxxxx
 
- In-reply-to: <19991103133904.A6549@xxxxxxxx>
 
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
 
- References: <991103103452.ZM19665@xxxxxxxxxxxxxxxxxxxxxxx> 	<19991103133904.A6549@xxxxxxxx>
 
On Nov 3,  1:39pm, Clint Adams wrote:
> Subject: Re: Bad configure test for getpwent() ?
> >     pw1=getpwnam(buf);
> >     sprintf(buf, "%d:%d", rand(), getpid());
> >     pw2=getpwnam(buf);
> >     exit(pw1!=0 && pw2!=0 && !strcmp(pw1->pw_name, pw2->pw_name));
> 
> It's not comparing the pointers; it's comparing the names.
If pw1 == pw2, always, then strcmp(pw1->pw_name, pw2->pw_name) == 0, always.
> > I don't think getpwent() is required to return a unique pointer each time;
> > that is, I think it's allowed to re-use an internal static buffer for each
> > entry that it returns.  That would mean that this test always succeeds ...
>-- End of excerpt from Clint Adams
Messages sorted by:
Reverse Date,
Date,
Thread,
Author