about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-08-09 17:37:23 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2015-08-09 17:37:23 -0700
commitdf5f825538720a9422859200d58d075d1dd075fc (patch)
tree863d88901575ff33b0fc90db54404e32e75098db /Src
parenta88415cbf71a02cfe26647d1775b00044df262d1 (diff)
downloadzsh-df5f825538720a9422859200d58d075d1dd075fc.tar.gz
zsh-df5f825538720a9422859200d58d075d1dd075fc.tar.xz
zsh-df5f825538720a9422859200d58d075d1dd075fc.zip
36033: a few more queue_signals() to protect global state changes
Diffstat (limited to 'Src')
-rw-r--r--Src/glob.c4
-rw-r--r--Src/pattern.c8
2 files changed, 11 insertions, 1 deletions
diff --git a/Src/glob.c b/Src/glob.c
index eff34a24e..f82c3bd30 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -216,22 +216,26 @@ static struct globdata curglobdata;
 
 #define save_globstate(N) \
   do { \
+    queue_signals(); \
     memcpy(&(N), &curglobdata, sizeof(struct globdata)); \
     (N).gd_pathpos = pathpos; \
     (N).gd_pathbuf = pathbuf; \
     (N).gd_glob_pre = glob_pre; \
     (N).gd_glob_suf = glob_suf; \
     pathbuf = NULL; \
+    unqueue_signals(); \
   } while (0)
 
 #define restore_globstate(N) \
   do { \
+    queue_signals(); \
     zfree(pathbuf, pathbufsz); \
     memcpy(&curglobdata, &(N), sizeof(struct globdata)); \
     pathpos = (N).gd_pathpos; \
     pathbuf = (N).gd_pathbuf; \
     glob_pre = (N).gd_glob_pre; \
     glob_suf = (N).gd_glob_suf; \
+    unqueue_signals(); \
   } while (0)
 
 /* pathname component in filename patterns */
diff --git a/Src/pattern.c b/Src/pattern.c
index 8fa1a727f..7d38988a0 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -520,6 +520,8 @@ patcompile(char *exp, int inflags, char **endexp)
     char *lng, *strp = NULL;
     Patprog p;
 
+    queue_signals();
+
     startoff = sizeof(struct patprog);
     /* Ensure alignment of start of program string */
     startoff = (startoff + sizeof(union upat) - 1) & ~(sizeof(union upat) - 1);
@@ -582,8 +584,10 @@ patcompile(char *exp, int inflags, char **endexp)
 	if (!strp || (*strp && *strp != '/')) {
 	    /* No, do normal compilation. */
 	    strp = NULL;
-	    if (patcompswitch(0, &flags) == 0)
+	    if (patcompswitch(0, &flags) == 0) {
+		unqueue_signals();
 		return NULL;
+	    }
 	} else {
 	    /*
 	     * Yes, copy the string, and skip compilation altogether.
@@ -715,6 +719,8 @@ patcompile(char *exp, int inflags, char **endexp)
 
     if (endexp)
 	*endexp = patparse;
+
+    unqueue_signals();
     return p;
 }