summaryrefslogtreecommitdiffstats
path: root/win/tclWinSock.c
diff options
context:
space:
mode:
authorstanton <stanton@noemail.net>1998-12-04 01:01:55 (GMT)
committerstanton <stanton@noemail.net>1998-12-04 01:01:55 (GMT)
commit73240bc821f508685f902e8eca461387995c04d6 (patch)
tree0ece9257288396d381360f94456b56c58d3b50ca /win/tclWinSock.c
parentd7ca75367c4f38d594f3e0bae19a901fba003230 (diff)
downloadtcl-73240bc821f508685f902e8eca461387995c04d6.zip
tcl-73240bc821f508685f902e8eca461387995c04d6.tar.gz
tcl-73240bc821f508685f902e8eca461387995c04d6.tar.bz2
* tclWinSock.c (CreateSocket, TcpAccept): Windows NT creates
sockets so they are inheritable by default. Turn off this bit so sockets aren't kept open by exec'ed processes. [Bug: 892] FossilOrigin-Name: 3f5af606c0baf0b984d9c2d0a86424875f9f78b8
Diffstat (limited to 'win/tclWinSock.c')
-rw-r--r--win/tclWinSock.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index d20a5fe..00e7f22 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinSock.c,v 1.3 1998/09/14 18:40:20 stanton Exp $
+ * RCS: @(#) $Id: tclWinSock.c,v 1.4 1998/12/04 01:01:55 stanton Exp $
*/
#include "tclInt.h"
@@ -903,6 +903,13 @@ CreateSocket(interp, port, host, server, myaddr, myport, async)
}
/*
+ * Win-NT has a misfeature that sockets are inherited in child
+ * processes by default. Turn off the inherit bit.
+ */
+
+ SetHandleInformation( (HANDLE) sock, HANDLE_FLAG_INHERIT, 0 );
+
+ /*
* Set kernel space buffering
*/
@@ -1397,6 +1404,13 @@ TcpAccept(infoPtr)
}
/*
+ * Win-NT has a misfeature that sockets are inherited in child
+ * processes by default. Turn off the inherit bit.
+ */
+
+ SetHandleInformation( (HANDLE) newSocket, HANDLE_FLAG_INHERIT, 0 );
+
+ /*
* Add this socket to the global list of sockets.
*/