From 18870148c5e4e71c356821000bb2b8d07366cd49 Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Fri, 7 Apr 2000 02:27:44 +0000 Subject: 10564: typo in _wanted 10565: maximum function depth configure option 10566: patgetglobflags has a second argument now --- Src/exec.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Src/exec.c') 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; -- cgit v1.2.3