From: Lennart Poettering Date: Wed, 27 Jan 2010 05:17:51 +0000 (+0100) Subject: reset signal mask when forking X-Git-Tag: 0.git+20100605+dfd8ee-1~395 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=309bff19edec5e5a5f6c66ead3b0aa1eb55e7bc7;p=systemd reset signal mask when forking --- diff --git a/execute.c b/execute.c index 5def5ce1..6b1d4a1d 100644 --- a/execute.c +++ b/execute.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "execute.h" #include "strv.h" @@ -121,8 +122,16 @@ int exec_spawn(const ExecCommand *command, const ExecContext *context, int *fds, char **e, **f = NULL; int i, r; char t[16]; + sigset_t ss; + /* child */ + if (sigemptyset(&ss) < 0 || + sigprocmask(SIG_SETMASK, &ss, NULL) < 0) { + r = EXIT_SIGNAL_MASK; + goto fail; + } + umask(context->umask); if (chdir(context->directory ? context->directory : "/") < 0) { diff --git a/execute.h b/execute.h index d339af93..b7dbe684 100644 --- a/execute.h +++ b/execute.h @@ -71,7 +71,8 @@ typedef enum ExitStatus { EXIT_EXEC, EXIT_MEMORY, EXIT_LIMITS, - EXIT_OOM_ADJUST + EXIT_OOM_ADJUST, + EXIT_SIGNAL_MASK } ExitStatus; int exec_spawn(const ExecCommand *command, const ExecContext *context, int *fds, unsigned n_fds, pid_t *ret);