summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-06-09 20:10:08 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-06-09 20:10:08 +0000
commit81052f38c7f81e8342057ee230477e74ac621735 (patch)
tree9edea01e4ad23c81928fe7ec5472504bb104c7b0
parent5053ea39ff884a26e4f295ef081414bf2704c37a (diff)
downloadexecline-81052f38c7f81e8342057ee230477e74ac621735.tar.xz
Real fix for the race condition in forstdin.c.
It was totally idiotic and I didn't see it; Olivier Brunel did. Herp derp.
-rw-r--r--src/execline/forstdin.c4
1 files changed, 3 insertions, 1 deletions
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, &parallel_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
{