hush: smaller code in !READONLY configs
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 17 Jul 2017 19:19:53 +0000 (21:19 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 17 Jul 2017 19:19:53 +0000 (21:19 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/hush.c

index a68986329c9c08dfbe2d387a8d68f35d429377c0..2125e757d82dbafcd5b9d295b3782960ab9509a5 100644 (file)
@@ -9347,11 +9347,14 @@ static int helper_export_local(char **argv,
                                }
                        }
 # if ENABLE_HUSH_LOCAL
-                       if (exp == 0 && ro == 0 /* local? */
-                        && var && var->func_nest_level == lvl
+                       /* Is this "local" bltin? */
+                       if (exp == 0
+                       IF_HUSH_READONLY(&& ro == 0) /* in !READONLY config, always true */
                        ) {
-                               /* "local x=abc; ...; local x" - ignore second local decl */
-                               continue;
+                               if (var && var->func_nest_level == lvl) {
+                                       /* "local x=abc; ...; local x" - ignore second local decl */
+                                       continue;
+                               }
                        }
 # endif
                        /* Exporting non-existing variable.