]> granicus.if.org Git - shadow/commitdiff
* Avoid assignment in comparisons, implicit comparison of integers to booleans.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 25 May 2008 21:23:28 +0000 (21:23 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 25 May 2008 21:23:28 +0000 (21:23 +0000)
* The return value of closedir is not checked on purpose.
* Add brackets.

ChangeLog
libmisc/chowndir.c

index d0e07da219b40116ddbe0f45b97352e384ef7a83..fc1a09d04241f5f89722cae05066508f79e3cbc2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-05-25  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * libmisc/chowndir.c: Avoid assignment in comparisons, implicit
+       comparison of integers to booleans.
+       * libmisc/chowndir.c: The return value of closedir is not checked
+       on purpose.
+       * libmisc/chowndir.c: Add brackets.
+
 2008-05-25  Nicolas François  <nicolas.francois@centraliens.net>
 
        * libmisc/chkname.h, libmisc/chkname.c: check_group_name (resp.
index 5b02b5b4aecc9f6cc152652b0903212c1575ec09..d02040236f799b6d1fcedbec4b2ef4f6b080d915 100644 (file)
@@ -104,9 +104,11 @@ chown_tree (const char *root, uid_t old_uid, uid_t new_uid, gid_t old_gid,
                         * Do the entire subdirectory.
                         */
 
-                       if ((rc = chown_tree (new_name, old_uid, new_uid,
-                                             old_gid, new_gid)))
+                       rc = chown_tree (new_name, old_uid, new_uid,
+                                        old_gid, new_gid);
+                       if (0 != rc) {
                                break;
+                       }
                }
 #ifndef HAVE_LCHOWN
                /* don't use chown (follows symbolic links!) */
@@ -117,16 +119,18 @@ chown_tree (const char *root, uid_t old_uid, uid_t new_uid, gid_t old_gid,
                        LCHOWN (new_name, new_uid,
                                sb.st_gid == old_gid ? new_gid : sb.st_gid);
        }
-       closedir (dir);
+       (void) closedir (dir);
 
        /*
         * Now do the root of the tree
         */
 
-       if (!stat (root, &sb)) {
-               if (sb.st_uid == old_uid)
+       if (stat (root, &sb) == 0) {
+               if (sb.st_uid == old_uid) {
                        LCHOWN (root, new_uid,
-                               sb.st_gid == old_gid ? new_gid : sb.st_gid);
+                               sb.st_gid == old_gid ? new_gid : sb.st_gid);
+               }
        }
        return rc;
 }
+