From f06a09b0f93e4831accf1bbdfb4a3a57e4aa956e Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 23 Oct 2015 16:41:04 -0700 Subject: [PATCH] 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. --- lib/xdg-app-helper.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/xdg-app-helper.c b/lib/xdg-app-helper.c index 052fc9aa..103d2e9b 100644 --- a/lib/xdg-app-helper.c +++ b/lib/xdg-app-helper.c @@ -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;