]> granicus.if.org Git - shadow/commitdiff
Avoid assignments in comparisons.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 26 May 2008 09:22:44 +0000 (09:22 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 26 May 2008 09:22:44 +0000 (09:22 +0000)
Add note about possible bug.

ChangeLog
lib/sgetpwent.c

index 08c9a2fab859b1c502646b80ce5f10806cdac1e2..a46972eb637924ee4bd3c85df8156686111152ab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@
        * lib/sgetpwent.c: Return NULL instead of 0.
        * lib/sgetpwent.c: Do not check twice if fields[2] and fields[3]
        are not empty.
+       * lib/sgetpwent.c: Avoid assignments in comparisons.
 
 2008-05-26  Nicolas François  <nicolas.francois@centraliens.net>
 
index 7e38c6c975876bd604edae6102715dcc581704e1..f43d1f0ab10c47d70cd4daeb1ddb779675258fbf 100644 (file)
@@ -108,12 +108,14 @@ struct passwd *sgetpwent (const char *buf)
 
        pwent.pw_name = fields[0];
        pwent.pw_passwd = fields[1];
-       if (
-           ((pwent.pw_uid = strtol (fields[2], &ep, 10)) == 0 && ('\0' != *ep))) {
+       pwent.pw_uid = strtol (fields[2], &ep, 10);
+       /* FIXME: (0 == pwent.pw_uid) does not look correct -- nekral */
+       if ((0 == pwent.pw_uid) && ('\0' != *ep)) {
                return NULL;
        }
-       if (
-           ((pwent.pw_gid = strtol (fields[3], &ep, 10)) == 0 && ('\0' != *ep))) {
+       /* FIXME: (0 == pwent.pw_gid) does not look correct -- nekral */
+       pwent.pw_gid = strtol (fields[3], &ep, 10);
+       if ((0 == pwent.pw_gid) && ('\0' != *ep))) {
                return NULL;
        }
        pwent.pw_gecos = fields[4];