diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2018-05-31 01:15:34 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-08-29 11:16:09 +0800 |
commit | 42298df5898a62f0df893be3af029d7e981623bd (patch) | |
tree | 5b9a00e582702d055b00fddaf83b6d9ad804ffd7 /src/eval.c | |
parent | expand: Do not reprocess data when expanding words (diff) | |
download | dash-42298df5898a62f0df893be3af029d7e981623bd.tar.gz dash-42298df5898a62f0df893be3af029d7e981623bd.zip |
eval: Always set localvar_stop
The variable localvar_stop is set iff vlocal is true. gcc doesn't get this so we get a spurious warning. This patch fixes this by always calling pushlocalvars with vlocal and making it only actually do the push if vlocal is non-zero. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/eval.c b/src/eval.c index c300d0c..6185db4 100644 --- a/src/eval.c +++ b/src/eval.c @@ -809,6 +809,8 @@ evalcommand(union node *cmd, int flags) vflags = VEXPORT; } + localvar_stop = pushlocalvars(vlocal); + /* Reserve one extra spot at the front for shellexec. */ nargv = stalloc(sizeof (char *) * (argc + 2)); argv = ++nargv; @@ -828,7 +830,6 @@ evalcommand(union node *cmd, int flags) status = redirectsafe(cmd->ncmd.redirect, REDIR_PUSH|REDIR_SAVEFD2); if (unlikely(status)) { - vlocal = 0; bail: exitstatus = status; @@ -839,9 +840,6 @@ bail: goto out; } - if (likely(vlocal)) - localvar_stop = pushlocalvars(); - for (argp = cmd->ncmd.assign; argp; argp = argp->narg.next) { struct strlist **spp; @@ -920,8 +918,7 @@ out: popredir(execcmd); unwindredir(redir_stop); unwindfiles(file_stop); - if (likely(vlocal)) - unwindlocalvars(localvar_stop); + unwindlocalvars(localvar_stop); if (lastarg) /* dsl: I think this is intended to be used to support * '_' in 'vi' command mode during line editing... |