]> granicus.if.org Git - icinga2/commitdiff
Ignore SIGPIPE earlier in the start-up process
authorGunnar Beutner <gunnar.beutner@icinga.com>
Thu, 12 Jan 2017 09:50:04 +0000 (10:50 +0100)
committerGunnar Beutner <gunnar.beutner@icinga.com>
Thu, 12 Jan 2017 09:50:43 +0000 (10:50 +0100)
fixes #13567

lib/base/application.cpp
lib/base/process.cpp

index e81c61edda8b1b9a1c04eece0da73151a189e8b6..fcccd4178be319e1da50d5015d06270747285a6e 100644 (file)
@@ -138,6 +138,11 @@ void Application::InitializeBase(void)
                        << boost::errinfo_api_function("WSAStartup")
                        << errinfo_win32_error(WSAGetLastError()));
        }
+#else /* _WIN32 */
+       struct sigaction sa;
+       memset(&sa, 0, sizeof(sa));
+       sa.sa_handler = SIG_IGN;
+       sigaction(SIGPIPE, &sa, NULL);
 #endif /* _WIN32 */
 
        Loader::ExecuteDeferredInitializers();
@@ -881,9 +886,6 @@ int Application::Run(void)
        sigaction(SIGINT, &sa, NULL);
        sigaction(SIGTERM, &sa, NULL);
 
-       sa.sa_handler = SIG_IGN;
-       sigaction(SIGPIPE, &sa, NULL);
-
        sa.sa_handler = &Application::SigUsr1Handler;
        sigaction(SIGUSR1, &sa, NULL);
 #else /* _WIN32 */
index 8fcf37c29a4baadec71ba7a3a47e80900b612e5c..d5db747bf5af51841c47c49c4b553c88dd2375f2 100644 (file)
@@ -167,7 +167,6 @@ static Value ProcessSpawnImpl(struct msghdr *msgh, const Dictionary::Ptr& reques
 
                sigset_t mask;
                sigemptyset(&mask);
-               sigaddset(&mask, SIGPIPE);
                sigprocmask(SIG_SETMASK, &mask, NULL);
 
                if (icinga2_execvpe(argv[0], argv, envp) < 0) {