]> granicus.if.org Git - shadow/commitdiff
Avoid assignment in comparisons.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 27 Dec 2007 23:30:36 +0000 (23:30 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 27 Dec 2007 23:30:36 +0000 (23:30 +0000)
ChangeLog
libmisc/copydir.c

index 59e5c21014b046b44b2f74b746496a4d8c1e3a28..e37374221d7b6e5fb82c4505c91d6b9e8a25700b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
        * libmisc/copydir.c: -1 is used to indicate an error, directly set err
        to -1, instead of incrementing it, and checking if not nul at the
        end.
+       * libmisc/copydir.c: Avoid assignment in comparisons.
 
 2007-12-27  Nicolas François  <nicolas.francois@centraliens.net>
 
index d3e11e856de6311ffe6eec1f08840824a1c80ad1..dbdf3e858e5f6c300aca2a959de8353446d3c56d 100644 (file)
@@ -185,8 +185,8 @@ int copy_tree (const char *src_root, const char *dst_root, uid_t uid, gid_t gid)
         * regular files (and directories ...) are copied, and no file
         * is made set-ID.
         */
-
-       if (!(dir = opendir (src_root)))
+       dir = opendir (src_root);
+       if (NULL == dir)
                return -1;
 
        if (src_orig == 0) {
@@ -431,14 +431,15 @@ static int copy_file (const char *src, const char *dst,
        char buf[1024];
        int cnt;
 
-       if ((ifd = open (src, O_RDONLY)) < 0) {
+       ifd = open (src, O_RDONLY);
+       if (ifd < 0) {
                return -1;
        }
 #ifdef WITH_SELINUX
        selinux_file_context (dst);
 #endif
-       if ((ofd =
-            open (dst, O_WRONLY | O_CREAT | O_TRUNC, 0)) < 0
+       ofd = open (dst, O_WRONLY | O_CREAT | O_TRUNC, 0);
+       if ((ofd < 0)
            || chown (dst,
                      uid == (uid_t) - 1 ? statp->st_uid : uid,
                      gid == (gid_t) - 1 ? statp->st_gid : gid)
@@ -495,8 +496,8 @@ int remove_tree (const char *root)
         * regular files (and directories ...) are copied, and no file
         * is made set-ID.
         */
-
-       if (!(dir = opendir (root)))
+       dir = opendir (root);
+       if (NULL == dir)
                return -1;
 
        while ((ent = readdir (dir))) {