summaryrefslogtreecommitdiffstats
path: root/unix
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)
commite6e220f14d2d0b998a5e2e1977116a701371a88f (patch)
tree67832ca442e0af5782ac8f1914ca1f29d2ee708e /unix
parent18e9a6f3e4ca3f54e389e421704129e2cb8d7fd6 (diff)
downloadtcl-e6e220f14d2d0b998a5e2e1977116a701371a88f.zip
tcl-e6e220f14d2d0b998a5e2e1977116a701371a88f.tar.gz
tcl-e6e220f14d2d0b998a5e2e1977116a701371a88f.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')
-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;