]> granicus.if.org Git - shadow/commitdiff
* libmisc/valid.c: Avoid implicit conversion of pointers /chars to booleans.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 25 May 2008 23:22:15 +0000 (23:22 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 25 May 2008 23:22:15 +0000 (23:22 +0000)
* libmisc/valid.c: Add brackets.

ChangeLog
libmisc/valid.c

index 58d7ef10bfd4fc1d1d5fdde836b7259024be55c7..cad11f962f381e7d4b322be4e13755ae87eafd30 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-05-26  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * libmisc/valid.c: Avoid implicit conversion of pointers /chars to
+       booleans.
+       * libmisc/valid.c: Add brackets.
+
 2008-05-26  Nicolas François  <nicolas.francois@centraliens.net>
 
        * libmisc/yesno.c: yes_or_no returns a bool instead of int.
index 3b68b9caad7218953b284e2b895d8e98ef6e7c82..e95b475a311b11e1c837b5bbabdea889232ce7cc 100644 (file)
@@ -61,11 +61,12 @@ int valid (const char *password, const struct passwd *ent)
         * routine is meant to waste CPU time.
         */
 
-       if (ent->pw_name && !ent->pw_passwd[0]) {
-               if (!password[0])
+       if ((NULL != ent->pw_name) && ('\0' == ent->pw_passwd[0])) {
+               if ('\0' == password[0]) {
                        return (1);     /* user entered nothing */
-               else
+               } else {
                        return (0);     /* user entered something! */
+               }
        }
 
        /*
@@ -93,9 +94,11 @@ int valid (const char *password, const struct passwd *ent)
         * cause non-existent users to not be validated.
         */
 
-       if (ent->pw_name && strcmp (encrypted, ent->pw_passwd) == 0)
+       if ((NULL != ent->pw_name) &&
+           (strcmp (encrypted, ent->pw_passwd) == 0)) {
                return (1);
-       else
+       } else {
                return (0);
+       }
 }