]> granicus.if.org Git - icinga2/commitdiff
Properly unmask signals for child processes
authorGunnar Beutner <gunnar.beutner@icinga.com>
Tue, 22 Nov 2016 12:45:59 +0000 (13:45 +0100)
committerGunnar Beutner <gunnar.beutner@icinga.com>
Tue, 22 Nov 2016 12:53:58 +0000 (13:53 +0100)
fixes #13269

lib/base/process.cpp

index 34504247b45055a1d5f1fd5a754afcc701d8d4ab..e1e687cedcda58403520798763bcf707d4073948 100644 (file)
@@ -165,6 +165,10 @@ static Value ProcessSpawnImpl(struct msghdr *msgh, const Dictionary::Ptr& reques
                        Log(LogWarning, "base", "Failed to renice child process.");
 #endif /* HAVE_NICE */
 
+               sigset_t mask;
+               sigemptyset(&mask);
+               sigprocmask(SIG_SETMASK, &mask, NULL);
+
                if (icinga2_execvpe(argv[0], argv, envp) < 0) {
                        char errmsg[512];
                        strcpy(errmsg, "execvpe(");
@@ -228,6 +232,10 @@ static Value ProcessWaitPIDImpl(struct msghdr *msgh, const Dictionary::Ptr& requ
 
 static void ProcessHandler(void)
 {
+       sigset_t mask;
+       sigfillset(&mask);
+       sigprocmask(SIG_SETMASK, &mask, NULL);
+
        rlimit rl;
        if (getrlimit(RLIMIT_NOFILE, &rl) >= 0) {
                rlim_t maxfds = rl.rlim_max;