[systemd-devel] [PATCH 4/5] shared:util : Remove shadow compile warning

philippedeswert at gmail.com philippedeswert at gmail.com
Thu Oct 16 14:43:52 PDT 2014


From: Philippe De Swert <philippedeswert at gmail.com>

Removes the following compilation warning:
src/shared/util.c: In function 'rm_rf_children_dangerous':
src/shared/util.c:2800:22: warning: declaration of 'is_dir' shadows a global declaration [-Wshadow]
In file included from src/shared/util.c:77:0:
src/shared/mkdir.h:45:5: warning: shadowed declaration is here [-Wshadow]
---
 src/shared/util.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/shared/util.c b/src/shared/util.c
index 5f6249e..1545547 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2797,7 +2797,7 @@ int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct
 
         for (;;) {
                 struct dirent *de;
-                bool is_dir, keep_around;
+                bool is_a_dir, keep_around;
                 struct stat st;
                 int r;
 
@@ -2821,17 +2821,17 @@ int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct
                                 continue;
                         }
 
-                        is_dir = S_ISDIR(st.st_mode);
+                        is_a_dir = S_ISDIR(st.st_mode);
                         keep_around =
                                 honour_sticky &&
                                 (st.st_uid == 0 || st.st_uid == getuid()) &&
                                 (st.st_mode & S_ISVTX);
                 } else {
-                        is_dir = de->d_type == DT_DIR;
+                        is_a_dir = de->d_type == DT_DIR;
                         keep_around = false;
                 }
 
-                if (is_dir) {
+                if (is_a_dir) {
                         int subdir_fd;
 
                         /* if root_dev is set, remove subdirectories only, if device is same as dir */
-- 
1.8.3.2



More information about the systemd-devel mailing list