]> granicus.if.org Git - shadow/commitdiff
Do not check twice if fields[2] and fields[3] are not empty.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 26 May 2008 09:17:17 +0000 (09:17 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 26 May 2008 09:17:17 +0000 (09:17 +0000)
ChangeLog
lib/sgetpwent.c

index 1274326d0c719e5cdfc1eba9dbed0fc50a1a2da6..08c9a2fab859b1c502646b80ce5f10806cdac1e2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,7 +4,8 @@
        booleans.
        * lib/sgetpwent.c: Add brackets and parenthesis.
        * lib/sgetpwent.c: Return NULL instead of 0.
-
+       * lib/sgetpwent.c: Do not check twice if fields[2] and fields[3]
+       are not empty.
 
 2008-05-26  Nicolas François  <nicolas.francois@centraliens.net>
 
index 3648e60c4e8979a47a45dcc81cbd18250b20d9be..7e38c6c975876bd604edae6102715dcc581704e1 100644 (file)
@@ -108,11 +108,11 @@ struct passwd *sgetpwent (const char *buf)
 
        pwent.pw_name = fields[0];
        pwent.pw_passwd = fields[1];
-       if (fields[2][0] == '\0' ||
+       if (
            ((pwent.pw_uid = strtol (fields[2], &ep, 10)) == 0 && ('\0' != *ep))) {
                return NULL;
        }
-       if (fields[3][0] == '\0' ||
+       if (
            ((pwent.pw_gid = strtol (fields[3], &ep, 10)) == 0 && ('\0' != *ep))) {
                return NULL;
        }