[Slirp] [Git][slirp/libslirp][master] 2 commits: fork_exec_child_setup: improve signal handling

Samuel Thibault gitlab at gitlab.freedesktop.org
Wed Jan 20 17:23:22 UTC 2021



Samuel Thibault pushed to branch master at slirp / libslirp


Commits:
eee9db9d by Nathaniel Wesley Filardo at 2021-01-20T17:09:48+00:00
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.

- - - - -
72654d84 by Samuel Thibault at 2021-01-20T17:23:18+00:00
Merge branch 'master' into 'master'

fork_exec_child_setup: improve signal handling

See merge request slirp/libslirp!61
- - - - -


1 changed file:

- src/misc.c


Changes:

=====================================
src/misc.c
=====================================
@@ -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
 }
 



View it on GitLab: https://gitlab.freedesktop.org/slirp/libslirp/-/compare/bacb71f1c3ed5f40e393afd8be81bedfba13a401...72654d84113c8b241028342b1b79d70220ff92bd

-- 
View it on GitLab: https://gitlab.freedesktop.org/slirp/libslirp/-/compare/bacb71f1c3ed5f40e393afd8be81bedfba13a401...72654d84113c8b241028342b1b79d70220ff92bd
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/slirp/attachments/20210120/69ba6c3e/attachment.htm>


More information about the Slirp mailing list