summaryrefslogtreecommitdiff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2000-04-07 02:27:44 +0000
committerClint Adams <clint@users.sourceforge.net>2000-04-07 02:27:44 +0000
commit18870148c5e4e71c356821000bb2b8d07366cd49 (patch)
treedd1b70ae888b2b26aeca95ffc8854cbc4123abdf /Src/exec.c
parentd2330ba0554b09a3f942a921acfbbabcf6466bef (diff)
downloadzsh-18870148c5e4e71c356821000bb2b8d07366cd49.tar.gz
zsh-18870148c5e4e71c356821000bb2b8d07366cd49.zip
10564: typo in _wanted
10565: maximum function depth configure option 10566: patgetglobflags has a second argument now
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 0dffaf4e2..79dca611d 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3251,6 +3251,9 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
char saveopts[OPT_SIZE], *oldscriptname = NULL, *fname = dupstring(name);
int obreaks;
struct funcstack fstack;
+#ifdef MAX_FUNCTION_DEPTH
+ static int funcdepth;
+#endif
pushheap();
@@ -3300,6 +3303,13 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
argzero = ztrdup(argzero);
}
}
+#ifdef MAX_FUNCTION_DEPTH
+ if(++funcdepth > MAX_FUNCTION_DEPTH)
+ {
+ zerr("maximum nested function level reached", NULL, 0);
+ return;
+ }
+#endif
fstack.name = dupstring(name);
fstack.prev = funcstack;
funcstack = &fstack;
@@ -3323,6 +3333,9 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
}
runshfunc(prog, wrappers, fstack.name);
funcstack = fstack.prev;
+#ifdef MAX_FUNCTION_DEPTH
+ --funcdepth;
+#endif
if (retflag) {
retflag = 0;
breaks = obreaks;