summaryrefslogtreecommitdiff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-05-23 11:44:47 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-05-23 11:44:47 +0000
commit6503964dad4555a9999c449dde6d499fa97a2f2e (patch)
treece4990df663f9b1f2a26f23dbfb3177e98b97636 /Src/exec.c
parentfcd2c9243fcb0e29098da9d9f815373d73d6b192 (diff)
downloadzsh-6503964dad4555a9999c449dde6d499fa97a2f2e.tar.gz
zsh-6503964dad4555a9999c449dde6d499fa97a2f2e.zip
John Buddery: 23461: fix race setting up input multios
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 5aa3dba12..f711f3d30 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1549,20 +1549,29 @@ closemn(struct multio **mfds, int fd)
pid_t pid;
struct timeval bgtime;
+ /*
+ * We need to block SIGCHLD in case the process
+ * we are spawning terminates before the job table
+ * is set up to handle it.
+ */
+ child_block();
if ((pid = zfork(&bgtime))) {
for (i = 0; i < mn->ct; i++)
zclose(mn->fds[i]);
zclose(mn->pipe);
- if (pid == -1) {
+ if (pid == -1) {
mfds[fd] = NULL;
+ child_unblock();
return;
}
mn->ct = 1;
mn->fds[0] = fd;
addproc(pid, NULL, 1, &bgtime);
+ child_unblock();
return;
}
/* pid == 0 */
+ child_unblock();
closeallelse(mn);
if (mn->rflag) {
/* tee process */