summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2013-11-14 10:25:33 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2013-11-14 10:25:33 (GMT)
commit1be1a5dfa47f7554343771f003ac35e8f1b8d5f3 (patch)
tree5a4e684400f8ce16e1a1b639e9133e5f293a6a25 /unix
parentefa791f58b11b26517b69bc62df734cd91275ee0 (diff)
parent695df45b409f7e616dc4cdfa24528d9900477663 (diff)
downloadtcl-1be1a5dfa47f7554343771f003ac35e8f1b8d5f3.zip
tcl-1be1a5dfa47f7554343771f003ac35e8f1b8d5f3.tar.gz
tcl-1be1a5dfa47f7554343771f003ac35e8f1b8d5f3.tar.bz2
merge trunk
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixSock.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index a6360c2..7ef28d8 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -737,7 +737,10 @@ TcpGetOptionProc(
if (statePtr->status == 0) {
ret = getsockopt(statePtr->fds.fd, SOL_SOCKET, SO_ERROR,
- (char *) &err, &optlen);
+ (char *) &err, &optlen);
+ if (statePtr->flags & TCP_ASYNC_CONNECT) {
+ statePtr->status = err;
+ }
if (ret < 0) {
err = errno;
}
@@ -1054,12 +1057,17 @@ CreateClientSocket(
*/
optlen = sizeof(int);
- getsockopt(state->fds.fd, SOL_SOCKET, SO_ERROR,
- (char *) &status, &optlen);
- state->status = status;
+
+ if (state->status == 0) {
+ getsockopt(state->fds.fd, SOL_SOCKET, SO_ERROR,
+ (char *) &status, &optlen);
+ state->status = status;
+ } else {
+ status = state->status;
+ state->status = 0;
+ }
}
if (status == 0) {
- CLEAR_BITS(state->flags, TCP_ASYNC_CONNECT);
goto out;
}
}
@@ -1067,6 +1075,7 @@ CreateClientSocket(
out:
+ CLEAR_BITS(state->flags, TCP_ASYNC_CONNECT);
if (async_callback) {
/*
* An asynchonous connection has finally succeeded or failed.