chiark / gitweb /
reset signal mask when forking
authorLennart Poettering <lennart@poettering.net>
Wed, 27 Jan 2010 05:17:51 +0000 (06:17 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 27 Jan 2010 05:17:51 +0000 (06:17 +0100)
execute.c
execute.h

index 5def5ce1af5c8a553867168d9721ff3a1510852e..6b1d4a1da1b941268a2fe0faa1d1322e55bc3f5e 100644 (file)
--- a/execute.c
+++ b/execute.c
@@ -6,6 +6,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
+#include <signal.h>
 
 #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) {
index d339af93dccba082c1af49da277eb8ab5035c63a..b7dbe68491eb26ea0a47860a832e3baa716c36e3 100644 (file)
--- 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);