summary refs log tree commit diff
diff options
context:
space:
mode:
authorherbert <herbert@gondor.apana.org.au>2005-02-28 21:14:16 +1100
committerHerbert Xu <herbert@gondor.apana.org.au>2005-09-26 18:33:04 +1000
commitd408b3638924bbacc018f75bfb9d9ba0589341ff (patch)
tree8d26aa19e346937c4a3d92ffefb98eb8ed33435a
parentReplaced EXEVAL with SKIPEVAL. (diff)
downloaddash-d408b3638924bbacc018f75bfb9d9ba0589341ff.tar.gz
dash-d408b3638924bbacc018f75bfb9d9ba0589341ff.zip
Update funcnest atomically.
-rw-r--r--ChangeLog1
-rw-r--r--src/eval.c7
2 files changed, 4 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index a2c06ad..35bcdda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2005-02-28  Herbert Xu <herbert@gondor.apana.org.au>
 
 	* Replaced EXEVAL with SKIPEVAL.
+	* Update funcnest atomically.
 
 2005-02-28  A Costa <agcosta@gis.net>
 
diff --git a/src/eval.c b/src/eval.c
index 3288837..e833882 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -87,7 +87,7 @@ __RCSID("$NetBSD: eval.c,v 1.71 2003/01/23 03:33:16 rafal Exp $");
 int evalskip;			/* set if we are skipping commands */
 STATIC int skipcount;		/* number of levels to skip */
 MKINIT int loopnest;		/* current loop nesting level */
-int funcnest;			/* depth of function calls */
+static int funcnest;		/* depth of function calls */
 
 
 char *commandname;
@@ -134,7 +134,6 @@ INCLUDE "eval.h"
 RESET {
 	evalskip = 0;
 	loopnest = 0;
-	funcnest = 0;
 }
 #endif
 
@@ -958,16 +957,16 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags)
 	localvars = NULL;
 	shellparam.malloc = 0;
 	func->count++;
+	funcnest++;
 	INTON;
 	shellparam.nparam = argc - 1;
 	shellparam.p = argv + 1;
 	shellparam.optind = 1;
 	shellparam.optoff = -1;
-	funcnest++;
 	evaltree(&func->n, flags & EV_TESTED);
-	funcnest--;
 funcdone:
 	INTOFF;
+	funcnest--;
 	freefunc(func);
 	poplocalvars();
 	localvars = savelocalvars;