Author: jilles
Date: Wed Dec 30 21:46:33 2009
New Revision: 201283
URL: http://svn.freebsd.org/changeset/base/201283

Log:
  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.

Modified:
  head/bin/sh/eval.c

Modified: head/bin/sh/eval.c
==============================================================================
--- head/bin/sh/eval.c  Wed Dec 30 21:35:34 2009        (r201282)
+++ head/bin/sh/eval.c  Wed Dec 30 21:46:33 2009        (r201283)
@@ -792,20 +792,20 @@ evalcommand(union node *cmd, int flags, 
                        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, 
                freeparam(&shellparam);
                shellparam = saveparam;
                handler = savehandler;
+               funcnest--;
                popredir();
                INTON;
                if (evalskip == SKIPFUNC) {
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to