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

Aurélien Aptel aaptel at suse.com
Wed Mar 9 15:39:05 UTC 2016


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.

Thanks!

-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG
Nürnberg)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s3-winbindd-use-1-instead-of-0-for-error-checking-ui.patch
Type: text/x-patch
Size: 1990 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160309/85877fd7/0001-s3-winbindd-use-1-instead-of-0-for-error-checking-ui.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160309/85877fd7/attachment.sig>


More information about the samba-technical mailing list