[PATCH] s3/winbindd: use == -1 instead of < 0 for error checking uid_t

Jeremy Allison jra at samba.org
Thu Jun 30 23:09:43 UTC 2016


On Fri, Jul 01, 2016 at 01:02:57AM +0200, Michael Adam wrote:
> On 2016-06-30 at 15:52 -0700, Jeremy Allison wrote:
> > On Wed, Mar 09, 2016 at 04:39:05PM +0100, Aurélien Aptel wrote:
> > > Hi,
> > > 
> > > Another PVS fix.
> > > 
> > > The sign of the uid_t type is left unspecified by POSIX. It's defined as
> > > an unsigned 32b int on Linux, therefore the < 0 check is always
> > > false.
> > > 
> > > For unsigned version of uid_t, "uid == -1" will implicitely cast -1 to
> > > unsigned making it a valid test for both signed and unsigned version of
> > > uid_t.
> > > 
> > > This commit makes the cast to uid_t explicit anyway. I think less
> > > magic is better in this case.
> > > 
> > > Please review&push.
> > 
> > Sorry for the delay. This LGTM.
> > 
> > Reviewed-by: Jeremy Allison <jra at samba.org>
> > 
> > Can I get a second Team reviewer ?
> 
> Generally, reviewed-by me.
> 
> Two minor comments, which you might or might not
> want to address:
> 
> - I would support having two patches: one for each file.
> - In the first hunk of the winbindd_pam patch, one
>   could even spare the "return -1;" with this patch :-)

I think these aren't necessary - it's a small, well contained
and obviously correct patch IMHO.



More information about the samba-technical mailing list