Subject: Backport of 2008-12-12 8.6 commit: Fix missing CLOEXEC on internal pipes [2417695]

From: ferrieux <[email-masked]>
Date: Fri, 7 Sep 2012 14:44:46 +0000

---
 ChangeLog           | 5 +++++
 unix/tclUnixNotfy.c | 6 ++++++
 win/buildall.vc.bat | 0
 3 files changed, 11 insertions(+)
 mode change 100644 => 100755 win/buildall.vc.bat

diff --git a/ChangeLog b/ChangeLog
index 18cdf37..b0fed83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-07  Alexandre Ferrieux <[email-masked]>
+
+	* unix/tclUnixNotfy.c Backport of 2008-12-12 8.6 commit: Fix
+	missing CLOEXEC on internal pipes [2417695]
+
 2012-08-25  Donal K. Fellows  <[email-masked]>
 
 	* library/msgs/uk.msg: [Bug 3561330]: Use the correct full name of
diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c
index 42cc7be..51f0b1f 100644
--- a/unix/tclUnixNotfy.c
+++ b/unix/tclUnixNotfy.c
@@ -1057,6 +1057,12 @@ NotifierThreadProc(
     if (TclUnixSetBlockingMode(fds[1], TCL_MODE_NONBLOCKING) < 0) {
 	Tcl_Panic("NotifierThreadProc: could not make trigger pipe non blocking");
     }
+    if (fcntl(receivePipe, F_SETFD, FD_CLOEXEC) < 0) {
+	Tcl_Panic("NotifierThreadProc: could not make receive pipe close-on-exec");
+    }
+    if (fcntl(fds[1], F_SETFD, FD_CLOEXEC) < 0) {
+	Tcl_Panic("NotifierThreadProc: could not make trigger pipe close-on-exec");
+    }
 
     /*
      * Install the write end of the pipe into the global variable.
diff --git a/win/buildall.vc.bat b/win/buildall.vc.bat
old mode 100644
new mode 100755
-- 
cgit v0.12