about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-02-20 18:45:36 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2015-02-20 18:45:36 -0800
commita4ff8e69570cbdb8e7d5bf1d5cc4000ffe63e15e (patch)
treec4a880ad9be1ccc491a6fbe12bb2d2b9afe312f6
parentb237ba0a8eaa5001283ac8448872021723b90aff (diff)
downloadzsh-a4ff8e69570cbdb8e7d5bf1d5cc4000ffe63e15e.tar.gz
zsh-a4ff8e69570cbdb8e7d5bf1d5cc4000ffe63e15e.tar.xz
zsh-a4ff8e69570cbdb8e7d5bf1d5cc4000ffe63e15e.zip
34590: queue_signals() around more scopes that manipulate global state
-rw-r--r--ChangeLog5
-rw-r--r--Src/exec.c4
-rw-r--r--Src/text.c15
3 files changed, 23 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index fbf11386b..3f8e9e0e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-20  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* 34590: Src/exec.c, Src/text.c: queue_signals() around more
+	scopes that manipulate global state
+
 2015-02-20  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 34587: Src/utils.c, Test/D07multibyte.ztst: ensure multibyte
diff --git a/Src/exec.c b/Src/exec.c
index 947b815f9..1a6149ad7 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2337,6 +2337,7 @@ addvars(Estate state, Wordcode pc, int addflags)
 void
 setunderscore(char *str)
 {
+    queue_signals();
     if (str && *str) {
 	int l = strlen(str) + 1, nl = (l + 31) & ~31;
 
@@ -2354,6 +2355,7 @@ setunderscore(char *str)
 	*zunderscore = '\0';
 	underscoreused = 1;
     }
+    unqueue_signals();
 }
 
 /* These describe the type of expansions that need to be done on the words
@@ -5319,7 +5321,7 @@ execsave(void)
 {
     struct execstack *es;
 
-    es = (struct execstack *) malloc(sizeof(struct execstack));
+    es = (struct execstack *) zalloc(sizeof(struct execstack));
     es->list_pipe_pid = list_pipe_pid;
     es->nowait = nowait;
     es->pline_level = pline_level;
diff --git a/Src/text.c b/Src/text.c
index 75f642c12..b58c2516d 100644
--- a/Src/text.c
+++ b/Src/text.c
@@ -173,6 +173,8 @@ getpermtext(Eprog prog, Wordcode c, int start_indent)
 {
     struct estate s;
 
+    queue_signals();
+
     if (!c)
 	c = prog->prog;
 
@@ -193,6 +195,9 @@ getpermtext(Eprog prog, Wordcode c, int start_indent)
     *tptr = '\0';
     freeeprog(prog);		/* mark as unused */
     untokenize(tbuf);
+
+    unqueue_signals();
+
     return tbuf;
 }
 
@@ -206,6 +211,8 @@ getjobtext(Eprog prog, Wordcode c)
 
     struct estate s;
 
+    queue_signals();
+
     if (!c)
 	c = prog->prog;
 
@@ -224,6 +231,9 @@ getjobtext(Eprog prog, Wordcode c)
     *tptr = '\0';
     freeeprog(prog);		/* mark as unused */
     untokenize(jbuf);
+
+    unqueue_signals();
+
     return jbuf;
 }
 
@@ -883,6 +893,9 @@ getredirs(LinkList redirs)
 	">", ">|", ">>", ">>|", "&>", "&>|", "&>>", "&>>|", "<>", "<",
 	"<<", "<<-", "<<<", "<&", ">&", NULL /* >&- */, "<", ">"
     };
+
+    queue_signals();
+
     taddchr(' ');
     for (n = firstnode(redirs); n; incnode(n)) {
 	Redir f = (Redir) getdata(n);
@@ -970,4 +983,6 @@ getredirs(LinkList redirs)
 	}
     }
     tptr--;
+
+    unqueue_signals();
 }