[icinga-checkins] icinga.org: icinga2/master: Fixed incorrect use of O_CLOEXEC.

git at icinga.org git at icinga.org
Wed Feb 13 12:39:55 CET 2013


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

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Feb 13 12:39:47 2013 +0100

Fixed incorrect use of O_CLOEXEC.

---

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

diff --git a/lib/base/process-unix.cpp b/lib/base/process-unix.cpp
index b74c1b7..75187fd 100644
--- a/lib/base/process-unix.cpp
+++ b/lib/base/process-unix.cpp
@@ -40,7 +40,7 @@ void Process::CreateWorkers(void)
 	if (flags < 0)
 		BOOST_THROW_EXCEPTION(PosixException("fcntl failed", errno));
 
-	if (fcntl(fds[1], F_SETFL, flags | O_NONBLOCK | O_CLOEXEC) < 0)
+	if (fcntl(fds[1], F_SETFL, flags | O_NONBLOCK | FD_CLOEXEC) < 0)
 		BOOST_THROW_EXCEPTION(PosixException("fcntl failed", errno));
 
 	for (int i = 0; i < thread::hardware_concurrency(); i++) {
@@ -56,7 +56,7 @@ void Process::CreateWorkers(void)
 		if (flags < 0)
 			BOOST_THROW_EXCEPTION(PosixException("fcntl failed", errno));
 
-		if (fcntl(childTaskFd, F_SETFL, flags | O_NONBLOCK | O_CLOEXEC) < 0)
+		if (fcntl(childTaskFd, F_SETFL, flags | O_NONBLOCK | FD_CLOEXEC) < 0)
 			BOOST_THROW_EXCEPTION(PosixException("fcntl failed", errno));
 
 		thread t(&Process::WorkerThreadProc, childTaskFd);
@@ -190,14 +190,14 @@ void Process::InitTask(void)
 	if (flags < 0)
 		BOOST_THROW_EXCEPTION(PosixException("fcntl failed", errno));
 
-	if (fcntl(fds[0], F_SETFL, flags | O_NONBLOCK | O_CLOEXEC) < 0)
+	if (fcntl(fds[0], F_SETFL, flags | O_NONBLOCK | FD_CLOEXEC) < 0)
 		BOOST_THROW_EXCEPTION(PosixException("fcntl failed", errno));
 
 	flags = fcntl(fds[1], F_GETFL, 0);
 	if (flags < 0)
 		BOOST_THROW_EXCEPTION(PosixException("fcntl failed", errno));
 
-	if (fcntl(fds[1], F_SETFL, flags | O_NONBLOCK | O_CLOEXEC) < 0)
+	if (fcntl(fds[1], F_SETFL, flags | O_NONBLOCK | FD_CLOEXEC) < 0)
 		BOOST_THROW_EXCEPTION(PosixException("fcntl failed", errno));
 #endif /* HAVE_PIPE2 */
 





More information about the icinga-checkins mailing list