summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorstanton <stanton>1998-12-04 01:01:55 (GMT)
committerstanton <stanton>1998-12-04 01:01:55 (GMT)
commitb52dbdeae0bd7a2fabd0e79d7834c69e0209c5ad (patch)
tree0ece9257288396d381360f94456b56c58d3b50ca /win
parent0e7017ef8cdb01ecd282c0cb599bf8dd59149c34 (diff)
downloadtcl-b52dbdeae0bd7a2fabd0e79d7834c69e0209c5ad.zip
tcl-b52dbdeae0bd7a2fabd0e79d7834c69e0209c5ad.tar.gz
tcl-b52dbdeae0bd7a2fabd0e79d7834c69e0209c5ad.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]
Diffstat (limited to 'win')
-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.
*/