summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixSock.c
diff options
context:
space:
mode:
authordgp@users.sourceforge.net <dgp>2012-05-22 15:11:01 (GMT)
committerdgp@users.sourceforge.net <dgp>2012-05-22 15:11:01 (GMT)
commit9000317a9b1a6e3693c53d73ab6ba74bb6e89a44 (patch)
tree67832ca442e0af5782ac8f1914ca1f29d2ee708e /unix/tclUnixSock.c
parent5aeefd38f27f21d9c9111d35f1f55881661de213 (diff)
downloadtcl-9000317a9b1a6e3693c53d73ab6ba74bb6e89a44.zip
tcl-9000317a9b1a6e3693c53d73ab6ba74bb6e89a44.tar.gz
tcl-9000317a9b1a6e3693c53d73ab6ba74bb6e89a44.tar.bz2
Avoid calling close() on a bogus fd when an attempt to open a client socket
with an unsupported address family leaves one behind.
Diffstat (limited to 'unix/tclUnixSock.c')
-rw-r--r--unix/tclUnixSock.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index e48cc2b..12e5a9a 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -545,6 +545,9 @@ TcpCloseProc(
*/
for (fds = &statePtr->fds; fds != NULL; fds = fds->next) {
+ if (fds->fd < 0) {
+ continue;
+ }
Tcl_DeleteFileHandler(fds->fd);
if (close(fds->fd) < 0) {
errorCode = errno;