]> granicus.if.org Git - shadow/commitdiff
Avoid implicit brackets.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 28 Dec 2007 22:34:14 +0000 (22:34 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 28 Dec 2007 22:34:14 +0000 (22:34 +0000)
ChangeLog
src/chpasswd.c

index a1788ef85835bbcdb6b6a3e247223748f75d410b..54ac39b9f85dd184a00d6a19b3da1846a13cdbf3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@
        This force flushing the password database after the password file is
        unlocked.
        * src/chpasswd.c: Avoid assignments in comparisons.
+       * src/chpasswd.c: Avoid implicit brackets.
 
 2007-12-28  Nicolas François  <nicolas.francois@centraliens.net>
 
index 5d4ea864a494809cfbb121c76c4633602bed2ab2..652767199c1181cb4903b6e6092778de64eb6175 100644 (file)
@@ -382,13 +382,15 @@ int main (int argc, char **argv)
                    (NULL == crypt_method ||
                     0 != strcmp(crypt_method, "NONE"))) {
                        void *arg = NULL;
-                       if (md5flg)
+                       if (md5flg) {
                                crypt_method = "MD5";
-                       else if (crypt_method != NULL) {
-                               if (sflg)
+                       else if (crypt_method != NULL) {
+                               if (sflg) {
                                        arg = &sha_rounds;
-                       } else
+                               }
+                       } else {
                                crypt_method = NULL;
+                       }
                        cp = pw_encrypt (newpwd,
                                         crypt_make_salt(crypt_method, arg));
                }
@@ -405,10 +407,11 @@ int main (int argc, char **argv)
                        errors++;
                        continue;
                }
-               if (is_shadow_pwd)
+               if (is_shadow_pwd) {
                        sp = spw_locate (name);
-               else
+               } else {
                        sp = NULL;
+               }
 
                /*
                 * The freshly encrypted new password is merged into the
@@ -429,10 +432,11 @@ int main (int argc, char **argv)
                 * be written to the password file later, after all the
                 * other entries have been updated as well.
                 */
-               if (sp)
+               if (sp) {
                        ok = spw_update (&newsp);
-               else
+               } else {
                        ok = pw_update (&newpw);
+               }
 
                if (!ok) {
                        fprintf (stderr,
@@ -454,8 +458,9 @@ int main (int argc, char **argv)
        if (errors) {
                fprintf (stderr,
                         _("%s: error detected, changes ignored\n"), Prog);
-               if (is_shadow_pwd)
+               if (is_shadow_pwd) {
                        spw_unlock ();
+               }
                pw_unlock ();
                exit (1);
        }