s3/winbindd: use == -1 instead of < 0 for error checking uid_t
authorAurelien Aptel <aaptel@suse.com>
Wed, 9 Mar 2016 12:43:09 +0000 (13:43 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 1 Jul 2016 03:22:36 +0000 (05:22 +0200)
commitf13d07e459261ba0881ee725e94edd988c57479f
tree004c647e64809312661e45ad0f202108606053b4
parent8b7d92bb73c5519e70dc62723fb6d3db929d2cdb
s3/winbindd: use == -1 instead of < 0 for error checking uid_t

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.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri Jul  1 05:22:36 CEST 2016 on sn-devel-144
source3/winbindd/winbindd_cred_cache.c
source3/winbindd/winbindd_pam.c