sh: Ensure funcnest is decremented if there was an error in the function.

This will be important when things like 'command eval f' will be possible.
Currently, the funcnest = 0 assignment in RESET (called when returning to
the top level after an error in interactive mode) is really sufficient.
This commit is contained in:
Jilles Tjoelker 2009-12-30 21:46:33 +00:00
parent c7ab66020f
commit 92004afed0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=201283

View File

@ -792,20 +792,20 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
unreffunc(cmdentry.u.func);
poplocalvars();
localvars = savelocalvars;
funcnest--;
handler = savehandler;
longjmp(handler->loc, 1);
}
handler = &jmploc;
funcnest++;
INTON;
for (sp = varlist.list ; sp ; sp = sp->next)
mklocal(sp->text);
funcnest++;
exitstatus = oexitstatus;
if (flags & EV_TESTED)
evaltree(getfuncnode(cmdentry.u.func), EV_TESTED);
else
evaltree(getfuncnode(cmdentry.u.func), 0);
funcnest--;
INTOFF;
unreffunc(cmdentry.u.func);
poplocalvars();
@ -813,6 +813,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
freeparam(&shellparam);
shellparam = saveparam;
handler = savehandler;
funcnest--;
popredir();
INTON;
if (evalskip == SKIPFUNC) {