aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-07-26 20:00:08 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-26 20:33:51 +0200
commit85241c7b0b4558f405f7e633ad62520299b8396d (patch)
tree2193a2a3df5a0a26c8bc0f74d6a0796628d82573
parent484fc2056df8a82acabc70386eeb6d0da4982fec (diff)
downloadbusybox-w32-85241c7b0b4558f405f7e633ad62520299b8396d.tar.gz
busybox-w32-85241c7b0b4558f405f7e633ad62520299b8396d.tar.bz2
busybox-w32-85241c7b0b4558f405f7e633ad62520299b8396d.zip
ash: [VAR] Do not poplocalvars prematurely on regular utilities
Upstream commit: Date: Thu, 27 May 2010 11:50:19 +0800 [VAR] Do not poplocalvars prematurely on regular utilities The recent cmdenviron removal broke regular utilities by calling poplocalvars too early. This patch fixes that by postponing the poplocalvars for regular utilities until they have completed. In order to ensure that local still works, it is now a special built-in. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c
index f7fc18f0d..3604af4fc 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -9539,7 +9539,7 @@ static const struct builtincmd builtintab[] = {
9539#if ENABLE_FEATURE_SH_MATH 9539#if ENABLE_FEATURE_SH_MATH
9540 { BUILTIN_NOSPEC "let" , letcmd }, 9540 { BUILTIN_NOSPEC "let" , letcmd },
9541#endif 9541#endif
9542 { BUILTIN_ASSIGN "local" , localcmd }, 9542 { BUILTIN_SPEC_REG_ASSG "local" , localcmd },
9543#if ENABLE_ASH_PRINTF 9543#if ENABLE_ASH_PRINTF
9544 { BUILTIN_REGULAR "printf" , printfcmd }, 9544 { BUILTIN_REGULAR "printf" , printfcmd },
9545#endif 9545#endif
@@ -9849,9 +9849,11 @@ evalcommand(union node *cmd, int flags)
9849 /* NOTREACHED */ 9849 /* NOTREACHED */
9850 } /* default */ 9850 } /* default */
9851 case CMDBUILTIN: 9851 case CMDBUILTIN:
9852 poplocalvars(spclbltin > 0 || argc == 0); 9852 if (spclbltin > 0 || argc == 0) {
9853 if (cmd_is_exec && argc > 1) 9853 poplocalvars(1);
9854 listsetvar(varlist.list, VEXPORT); 9854 if (cmd_is_exec && argc > 1)
9855 listsetvar(varlist.list, VEXPORT);
9856 }
9855 9857
9856 /* Tight loop with builtins only: 9858 /* Tight loop with builtins only:
9857 * "while kill -0 $child; do true; done" 9859 * "while kill -0 $child; do true; done"