about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-12-07 10:33:58 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-12-07 10:33:58 +0000
commitf9bf1dc5580b6065f8b69668440325564be79594 (patch)
tree69e8d68a021a268fdff462caa14d34178b9a9b94
parent176b4aeb54591ae7f937e754368de69e359b56d6 (diff)
downloadzsh-f9bf1dc5580b6065f8b69668440325564be79594.tar.gz
zsh-f9bf1dc5580b6065f8b69668440325564be79594.tar.xz
zsh-f9bf1dc5580b6065f8b69668440325564be79594.zip
Guillaume Chazarain: 24170: block interrupts around fork()
-rw-r--r--ChangeLog5
-rw-r--r--Src/exec.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 862050ee0..87b322119 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-12-07  Peter Stephenson  <pws@csr.com>
+
+	* Guillaume Chazarain: 24170: Src/exec.c: block interrupts
+	around fork since it may mess with locks.
+
 2007-12-07  Clint Adams  <clint@zsh.org>
 
 	* 24172 (tweaked): configure.ac: check ncurses.h, ncurses/ncurses.h, and
diff --git a/Src/exec.c b/Src/exec.c
index cf79ea88b..6f16b9e87 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -229,6 +229,7 @@ zfork(struct timeval *tv)
 {
     pid_t pid;
     struct timezone dummy_tz;
+    sigset_t signals;
 
     /*
      * Is anybody willing to explain this test?
@@ -239,7 +240,10 @@ zfork(struct timeval *tv)
     }
     if (tv)
 	gettimeofday(tv, &dummy_tz);
+    sigfillset(&signals);
+    signals = signal_block(signals);
     pid = fork();
+    signal_setmask(signals);
     if (pid == -1) {
 	zerr("fork failed: %e", errno);
 	return -1;