]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: chown, chgrp, chmod, chcon: remove unnecessary initialization
authorJim Meyering <meyering@redhat.com>
Mon, 31 Aug 2009 16:26:16 +0000 (18:26 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 1 Sep 2009 10:10:07 +0000 (12:10 +0200)
* src/chown-core.c: Include "ignore-value.h".
(change_file_owner): Don't set "ent" only to ignore it.
* src/chcon.c (process_file): Likewise.
* src/chmod.c: Include "ignore-value.h".
(process_file): Don't set "ent" only to ignore it.
After diagnosing root-dev/ino failure, return false immediately:
Now that we don't set "ent" we must be sure not to use it uninitialized,
and there's no point in issuing --verbose-related output in this case.

src/chcon.c
src/chmod.c
src/chown-core.c

index 26626006622ffbf22a9486715af1ca680fe757da..531ed7a0dc4e4606d5a7614a4c1faaeb44d6f430 100644 (file)
@@ -22,6 +22,7 @@
 #include "system.h"
 #include "dev-ino.h"
 #include "error.h"
+#include "ignore-value.h"
 #include "quote.h"
 #include "quotearg.h"
 #include "root-dev-ino.h"
@@ -225,7 +226,7 @@ process_file (FTS *fts, FTSENT *ent)
               /* Tell fts not to traverse into this hierarchy.  */
               fts_set (fts, ent, FTS_SKIP);
               /* Ensure that we do not process "/" on the second visit.  */
-              ent = fts_read (fts);
+              ignore_ptr (fts_read (fts));
               return false;
             }
           return true;
index 0e39c8b01086e6b00dfa0ef40d521682910412ca..aeefcc65a7a60a970e870330dbc46e60226aecc8 100644 (file)
@@ -25,6 +25,7 @@
 #include "dev-ino.h"
 #include "error.h"
 #include "filemode.h"
+#include "ignore-value.h"
 #include "modechange.h"
 #include "quote.h"
 #include "quotearg.h"
@@ -238,8 +239,8 @@ process_file (FTS *fts, FTSENT *ent)
       /* Tell fts not to traverse into this hierarchy.  */
       fts_set (fts, ent, FTS_SKIP);
       /* Ensure that we do not process "/" on the second visit.  */
-      ent = fts_read (fts);
-      ok = false;
+      ignore_ptr (fts_read (fts));
+      return false;
     }
 
   if (ok)
index 7e5774ee1ed96b50449c23db16e17626bacc11e3..eb349049eb94ddb69c16aad1d8beac9445ada1ea 100644 (file)
@@ -25,6 +25,7 @@
 #include "system.h"
 #include "chown-core.h"
 #include "error.h"
+#include "ignore-value.h"
 #include "quote.h"
 #include "root-dev-ino.h"
 #include "xfts.h"
@@ -270,7 +271,7 @@ change_file_owner (FTS *fts, FTSENT *ent,
               /* Tell fts not to traverse into this hierarchy.  */
               fts_set (fts, ent, FTS_SKIP);
               /* Ensure that we do not process "/" on the second visit.  */
-              ent = fts_read (fts);
+              ignore_ptr (fts_read (fts));
               return false;
             }
           return true;