diff options
author | Nathaniel Wesley Filardo <nfilardo@microsoft.com> | 2021-01-14 22:18:53 +0000 |
---|---|---|
committer | Nathaniel Wesley Filardo <nfilardo@microsoft.com> | 2021-01-20 17:09:48 +0000 |
commit | eee9db9d115d91aa82f33685c4e76d656db92976 (patch) | |
tree | 5978d3ecf0b313ceab12207ba8dcb399ceb13855 | |
parent | bacb71f1c3ed5f40e393afd8be81bedfba13a401 (diff) | |
download | slirp-eee9db9d115d91aa82f33685c4e76d656db92976.zip slirp-eee9db9d115d91aa82f33685c4e76d656db92976.tar.gz slirp-eee9db9d115d91aa82f33685c4e76d656db92976.tar.bz2 |
fork_exec_child_setup: improve signal handling
Blocked signal state is inherited across exec(), so let's zero that out rather
than inherit whatever it was when we spawned the child.
POSIX has some strange rules about SIG_IGN'd SIGCHLD across exec, so let's not
do that, just for consistency.
-rw-r--r-- | src/misc.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -136,6 +136,14 @@ static void fork_exec_child_setup(gpointer data) { #ifndef _WIN32 setsid(); + + /* Unblock all signals and leave our exec()-ee to block what it wants */ + sigset_t ss; + sigemptyset(&ss); + sigprocmask(SIG_SETMASK, &ss, NULL); + + /* POSIX is obnoxious about SIGCHLD specifically across exec() */ + signal(SIGCHLD, SIG_DFL); #endif } |