From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26368 invoked from network); 3 Nov 1999 20:14:58 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 3 Nov 1999 20:14:58 -0000 Received: (qmail 5448 invoked by alias); 3 Nov 1999 20:14:51 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8531 Received: (qmail 5441 invoked from network); 3 Nov 1999 20:14:50 -0000 From: "Bart Schaefer" Message-Id: <991103201414.ZM21078@candle.brasslantern.com> Date: Wed, 3 Nov 1999 20:14:14 +0000 In-Reply-To: <19991103133904.A6549@dman.com> Comments: In reply to Clint Adams "Re: Bad configure test for getpwent() ?" (Nov 3, 1:39pm) References: <991103103452.ZM19665@candle.brasslantern.com> <19991103133904.A6549@dman.com> X-Mailer: Z-Mail Lite (5.0.0 30July97) To: Clint Adams Subject: Re: Bad configure test for getpwent() ? Cc: zsh-workers@sunsite.auc.dk MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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