summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authormax <max@tclers.tk>2014-03-10 18:11:08 (GMT)
committermax <max@tclers.tk>2014-03-10 18:11:08 (GMT)
commit4964ea0ff919aca3e872155d323cd72868cb93f3 (patch)
treefc99721f9ac6869e4f7cad85a7209198940d905d /unix
parent138267abe275e454e892fe55ad5f3e16fd032278 (diff)
downloadtcl-4964ea0ff919aca3e872155d323cd72868cb93f3.zip
tcl-4964ea0ff919aca3e872155d323cd72868cb93f3.tar.gz
tcl-4964ea0ff919aca3e872155d323cd72868cb93f3.tar.bz2
WaitForConnect may only call back to CreateClientSocket when the socket is writable or something. When it does so for a pending socket, it is falsely assumed to have succeeded and a subsequent read/write operation will fail.
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixSock.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index 41d729e..6e84ed5 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -417,7 +417,9 @@ WaitForConnect(
errno = 0;
state = TclUnixWaitForFile(statePtr->fds.fd,
TCL_WRITABLE | TCL_EXCEPTION, timeOut);
- CreateClientSocket(NULL, statePtr);
+ if (state != 0) {
+ CreateClientSocket(NULL, statePtr);
+ }
if (statePtr->flags & TCP_ASYNC_CONNECT) {
/* We are still in progress, so ignore the result of the last
* attempt */