[icinga-checkins] icinga.org: icinga2/master: Ignore SIGPIPE earlier in the start-up process

git at icinga.org git at icinga.org
Thu Jan 12 10:54:03 CET 2017


Module: icinga2
Branch: master
Commit: 751ca67e0a96d3d76d51ef86e235e6f9f421b6b6
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=751ca67e0a96d3d76d51ef86e235e6f9f421b6b6

Author: Gunnar Beutner <gunnar.beutner at icinga.com>
Date:   Thu Jan 12 10:50:04 2017 +0100

Ignore SIGPIPE earlier in the start-up process

fixes #13567

---

 lib/base/application.cpp |    8 +++++---
 lib/base/process.cpp     |    1 -
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/base/application.cpp b/lib/base/application.cpp
index e81c61e..fcccd41 100644
--- a/lib/base/application.cpp
+++ b/lib/base/application.cpp
@@ -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 */
diff --git a/lib/base/process.cpp b/lib/base/process.cpp
index 8fcf37c..d5db747 100644
--- a/lib/base/process.cpp
+++ b/lib/base/process.cpp
@@ -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) {



More information about the icinga-checkins mailing list