From 81052f38c7f81e8342057ee230477e74ac621735 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 9 Jun 2015 20:10:08 +0000 Subject: Real fix for the race condition in forstdin.c. It was totally idiotic and I didn't see it; Olivier Brunel did. Herp derp. --- src/execline/forstdin.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/execline/forstdin.c b/src/execline/forstdin.c index 3fb52eb..3b52fab 100644 --- a/src/execline/forstdin.c +++ b/src/execline/forstdin.c @@ -98,7 +98,7 @@ int main (int argc, char const **argv, char const *const *envp) if (pids.s) { if (sig_catch(SIGCHLD, ¶llel_sigchld_handler) < 0) - strerr_diefu2sys(111, "install", " SIGCHLD handler") ; + strerr_diefu1sys(111, "install SIGCHLD handler") ; } for (;;) { @@ -128,12 +128,14 @@ int main (int argc, char const **argv, char const *const *envp) if (!stralloc_0(&modif)) strerr_diefu1sys(111, "stralloc_0") ; if (!env_merge(newenv, envlen+2, envp, envlen, modif.s, modif.len)) strerr_diefu1sys(111, "merge environment") ; + if (pids.s) sig_block(SIGCHLD) ; pid = el_spawn0(argv[1], argv + 1, newenv) ; if (!pid) strerr_diefu2sys(111, "spawn ", argv[1]) ; if (pids.s) { if (!genalloc_append(pid_t, &pids, &pid)) strerr_diefu1sys(111, "genalloc_append") ; + sig_unblock(SIGCHLD) ; } else { -- cgit v1.2.3