Subject: Re: port-i386/33525: Bug in privoxy-3.0.3nb4 prevents option --user from working
To: None <port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: Spinor <fenicottero@gmail.com>
List: netbsd-bugs
Date: 05/21/2006 20:10:02
The following reply was made to PR port-i386/33525; it has been noted by GNATS.

From: Spinor <fenicottero@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-i386/33525: Bug in privoxy-3.0.3nb4 prevents option --user from working
Date: Mon, 22 May 2006 01:05:05 +0400

 On Sun, May 21, 2006 at 19:55 +0000, David Laight wrote:
 > The following reply was made to PR port-i386/33525; it has been noted by GNATS.
 > 
 > From: David Laight <david@l8s.co.uk>
 > To: gnats-bugs@NetBSD.org
 > Cc: 
 > Subject: Re: port-i386/33525: Bug in privoxy-3.0.3nb4 prevents option --user from working
 > Date: Sun, 21 May 2006 20:59:16 +0100
 > 
 >  On Sun, May 21, 2006 at 07:45:00PM +0000, fenicottero@gmail.com wrote:
 >  > >Number:         33525
 >  > >Synopsis:       Bug in privoxy-3.0.3nb4 prevents option --user from working
 >  
 >  > if (((NULL != grp) && setgid(grp->gr_gid)) || (setgid(pw->pw_gid)))
 >  > 
 >  > On other systems the behavior depends on order of evaluation
 >  > in the line above.
 >  
 >  The order of evaluation for that expression is defined by the C
 >  language, so should not be system dependant.
 
 AFAIK, the order of evaluation of arguments of || isn't specified in standard and is implementation-dependant.
 Unfortunately, arguments bring side-effects here...
 
 >  
 >  OTOH the code doesn't seem to be correct!  Possibly:
 >  
 >  if (setgid(grp ? grp->gr_gid : pw->pw_gid) != 0)
 >  
 >  might be what was intended.
 
 Yes, you are right. The code in privoxy is incorrect and your line is correct.
 The line that I commited in the patch does the same, but is longer.
 
 >  
 >  	David
 >  
 >  -- 
 >  David Laight: david@l8s.co.uk
 >