From 1d806ac1fbafb867f6252e184e1be05c0829ab71 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Thu, 27 May 2010 11:50:19 +0800 Subject: [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 --- src/builtins.def.in | 2 +- src/eval.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/builtins.def.in b/src/builtins.def.in index 266d0ec..4441fe4 100644 --- a/src/builtins.def.in +++ b/src/builtins.def.in @@ -71,7 +71,7 @@ falsecmd -u false getoptscmd -u getopts hashcmd hash jobscmd -u jobs -localcmd -a local +localcmd -as local printfcmd printf pwdcmd pwd readcmd -u read diff --git a/src/eval.c b/src/eval.c index 2cd931b..337667f 100644 --- a/src/eval.c +++ b/src/eval.c @@ -847,9 +847,11 @@ bail: /* NOTREACHED */ case CMDBUILTIN: - poplocalvars(spclbltin > 0 || argc == 0); - if (execcmd && argc > 1) - listsetvar(varlist.list, VEXPORT); + if (spclbltin > 0 || argc == 0) { + poplocalvars(1); + if (execcmd && argc > 1) + listsetvar(varlist.list, VEXPORT); + } if (evalbltin(cmdentry.u.cmd, argc, argv, flags)) { int status; int i; -- cgit 1.4.1