helper: unblock SIGCHILD before execvp() of child

We don't want to block SIGCHILD from being handled by the child process,
as that could be necessary for g_child_watch_add(), waitpid(), or similar.
tingping/wmclass
Christian Hergert 2015-10-23 16:41:04 -07:00 committed by Alexander Larsson
parent f83224c948
commit f06a09b0f9
1 changed files with 14 additions and 0 deletions

View File

@ -1740,6 +1740,18 @@ block_sigchild (void)
die_with_error ("sigprocmask");
}
static void
unblock_sigchild (void)
{
sigset_t mask;
sigemptyset (&mask);
sigaddset (&mask, SIGCHLD);
if (sigprocmask (SIG_UNBLOCK, &mask, NULL) == -1)
die_with_error ("sigprocmask");
}
static int
close_extra_fds (void *data, int fd)
{
@ -2522,6 +2534,8 @@ main (int argc,
if (sync_fd != -1)
close (sync_fd);
unblock_sigchild ();
if (execvp (args[0], args) == -1)
die_with_error ("execvp %s", args[0]);
return 0;