summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/exec.c6
-rw-r--r--Src/signals.c7
2 files changed, 8 insertions, 5 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 83f397335..ee0752035 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3495,7 +3495,8 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
 	memcpy(oldpipestats, pipestats, bytes);
     }
 
-    starttrapscope();
+    if (!intrap)
+	starttrapscope();
 
     tab = pparams;
     if (!(flags & PM_UNDEFINED))
@@ -3595,7 +3596,8 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
 	opts[LOCALOPTIONS] = saveopts[LOCALOPTIONS];
     }
 
-    endtrapscope();
+    if (!intrap)
+	endtrapscope();
 
     if (trapreturn < -1)
 	trapreturn++;
diff --git a/Src/signals.c b/Src/signals.c
index 1c134aaa6..064feb480 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -939,6 +939,10 @@ endtrapscope(void)
  * with non-standard sigtrapped & sigfuncs values
  */
 
+/* Are we already executing a trap? */
+/**/
+int intrap;
+
 /**/
 void
 dotrapargs(int sig, int *sigtr, void *sigfn)
@@ -949,9 +953,6 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
     int obreaks = breaks;
     int isfunc;
 
-    /* Are we already executing a trap? */
-    static int intrap;
-
     /* if signal is being ignored or the trap function		      *
      * is NULL, then return					      *
      *								      *