about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2013-10-17 07:35:05 -0700
committerBart Schaefer <schaefer@zsh.org>2013-10-17 07:35:05 -0700
commit978b5bcc8d21fce58369f810ef73bdbc434f33e7 (patch)
tree12ced4cf78665f221369e410d326af3f8a70ea1c /Src/exec.c
parentff520d1b798faa26037291e373689b5957784cc8 (diff)
downloadzsh-978b5bcc8d21fce58369f810ef73bdbc434f33e7.tar.gz
zsh-978b5bcc8d21fce58369f810ef73bdbc434f33e7.tar.xz
zsh-978b5bcc8d21fce58369f810ef73bdbc434f33e7.zip
31832: make execrestore() more signal-safe.
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/Src/exec.c b/Src/exec.c
index de1b4848e..8efbbd40c 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -5078,29 +5078,33 @@ execsave(void)
 void
 execrestore(void)
 {
-    struct execstack *en;
+    struct execstack *en = exstack;
 
     DPUTS(!exstack, "BUG: execrestore() without execsave()");
-    list_pipe_pid = exstack->list_pipe_pid;
-    nowait = exstack->nowait;
-    pline_level = exstack->pline_level;
-    list_pipe_child = exstack->list_pipe_child;
-    list_pipe_job = exstack->list_pipe_job;
-    strcpy(list_pipe_text, exstack->list_pipe_text);
-    lastval = exstack->lastval;
-    noeval = exstack->noeval;
-    badcshglob = exstack->badcshglob;
-    cmdoutpid = exstack->cmdoutpid;
-    cmdoutval = exstack->cmdoutval;
-    use_cmdoutval = exstack->use_cmdoutval;
-    trap_return = exstack->trap_return;
-    trap_state = exstack->trap_state;
-    trapisfunc = exstack->trapisfunc;
-    traplocallevel = exstack->traplocallevel;
-    noerrs = exstack->noerrs;
-    setunderscore(exstack->underscore);
-    zsfree(exstack->underscore);
-    en = exstack->next;
-    free(exstack);
-    exstack = en;
+
+    queue_signals();
+    exstack = exstack->next;
+
+    list_pipe_pid = en->list_pipe_pid;
+    nowait = en->nowait;
+    pline_level = en->pline_level;
+    list_pipe_child = en->list_pipe_child;
+    list_pipe_job = en->list_pipe_job;
+    strcpy(list_pipe_text, en->list_pipe_text);
+    lastval = en->lastval;
+    noeval = en->noeval;
+    badcshglob = en->badcshglob;
+    cmdoutpid = en->cmdoutpid;
+    cmdoutval = en->cmdoutval;
+    use_cmdoutval = en->use_cmdoutval;
+    trap_return = en->trap_return;
+    trap_state = en->trap_state;
+    trapisfunc = en->trapisfunc;
+    traplocallevel = en->traplocallevel;
+    noerrs = en->noerrs;
+    setunderscore(en->underscore);
+    zsfree(en->underscore);
+    free(en);
+
+    unqueue_signals();
 }