bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] loadables/mkdir: Fix 3 warnings


From: Jean Delvare
Subject: [PATCH] loadables/mkdir: Fix 3 warnings
Date: Fri, 06 Mar 2015 11:24:44 +0100

Fix the following 3 warnings when building mkdir loadable with -Wall:

mkdir.c:55:59: warning: unused variable "um" [-Wunused-variable]
   int opt, pflag, omode, rval, octal, nmode, parent_mode, um;
                                                           ^
mkdir.c:55:32: warning: variable "octal" set but not used 
[-Wunused-but-set-variable]
   int opt, pflag, omode, rval, octal, nmode, parent_mode, um;
                                ^
mkdir.c: In function "make_path":
mkdir.c:172:3: warning: suggest parentheses around assignment used as truth 
value [-Wparentheses]
   while (p = strchr (p, '/'))
   ^
---
 examples/loadables/mkdir.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- bash-4.3.orig/examples/loadables/mkdir.c    2015-03-04 13:35:58.958221399 
+0100
+++ bash-4.3/examples/loadables/mkdir.c 2015-03-04 13:36:25.271774981 +0100
@@ -52,7 +52,7 @@ int
 mkdir_builtin (list)
      WORD_LIST *list;
 {
-  int opt, pflag, omode, rval, octal, nmode, parent_mode, um;
+  int opt, pflag, omode, rval, nmode, parent_mode;
   char *mode;
   WORD_LIST *l;
 
@@ -90,7 +90,6 @@ mkdir_builtin (list)
          builtin_error ("invalid file mode: %s", mode);
          return (EXECUTION_FAILURE);
        }
-      octal = 1;
     }
   else if (mode)
     {
@@ -101,7 +100,6 @@ mkdir_builtin (list)
          builtin_error ("invalid file mode: %s", mode);
          return (EXECUTION_FAILURE);
        }
-      octal = 0;
     }
 
   /* Make the new mode */
@@ -169,7 +167,7 @@ make_path (path, nmode, parent_mode)
   while (*p == '/')
     p++;
 
-  while (p = strchr (p, '/'))
+  while ((p = strchr (p, '/')))
     {
       *p = '\0';
       if (stat (npath, &sb) != 0)

-- 
Jean Delvare
SUSE L3 Support




reply via email to

[Prev in Thread] Current Thread [Next in Thread]