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:
parent
ed965a92bc
commit
1200ca53ee
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user