summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixSock.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-05-22 15:11:01 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-05-22 15:11:01 (GMT)
commitd5f527fa644050ac60a1f22f5aa993453e1e7e58 (patch)
tree67832ca442e0af5782ac8f1914ca1f29d2ee708e /unix/tclUnixSock.c
parent37fe70162445331d0bd79172835efe7e4e8b7ed4 (diff)
downloadtcl-d5f527fa644050ac60a1f22f5aa993453e1e7e58.zip
tcl-d5f527fa644050ac60a1f22f5aa993453e1e7e58.tar.gz
tcl-d5f527fa644050ac60a1f22f5aa993453e1e7e58.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;