diff options
author | jilles <jilles@FreeBSD.org> | 2016-01-10 16:31:28 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2016-01-10 16:31:28 +0000 |
commit | d42a26ab2089d53213cf28c22508023ea16e7efb (patch) | |
tree | 0b136c34e36d2b2c085d1618158aaa9df9b91c19 /bin/sh/eval.c | |
parent | 21632a9bd96fd68b505602bfdd4850ab1e18574a (diff) | |
download | FreeBSD-src-d42a26ab2089d53213cf28c22508023ea16e7efb.zip FreeBSD-src-d42a26ab2089d53213cf28c22508023ea16e7efb.tar.gz |
sh: Update associated state when restoring locals while leaving a function.
Some variables like PATH call a function when modified. Make sure to call
this also when leaving a function where such a variable was made local.
Make sure to restore local variables before shellparam, so getopts state is
not clobbered.
Diffstat (limited to 'bin/sh/eval.c')
-rw-r--r-- | bin/sh/eval.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c index 5a3f8e7..949157d 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -1039,12 +1039,12 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd) reffunc(cmdentry.u.func); savehandler = handler; if (setjmp(jmploc.loc)) { - freeparam(&shellparam); - shellparam = saveparam; popredir(); unreffunc(cmdentry.u.func); poplocalvars(); localvars = savelocalvars; + freeparam(&shellparam); + shellparam = saveparam; funcnest--; handler = savehandler; longjmp(handler->loc, 1); |