summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-06-12 13:36:18 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-06-12 13:36:18 (GMT)
commit6eb1232f227042df7308c275bf6d0966ff7587e8 (patch)
tree956337e3143c32ad7847b7f04719219d91ba808d /unix
parent663ac41bc26d89297ae57c994693aa6aa90227e4 (diff)
downloadtcl-6eb1232f227042df7308c275bf6d0966ff7587e8.zip
tcl-6eb1232f227042df7308c275bf6d0966ff7587e8.tar.gz
tcl-6eb1232f227042df7308c275bf6d0966ff7587e8.tar.bz2
Additional check for an error condition on the socket.
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixChan.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index fc3c10f..1d60340 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -249,6 +249,7 @@ static int TtySetOptionProc(ClientData instanceData,
static int WaitForConnect(TcpState *statePtr, int *errorCodePtr);
static Tcl_Channel MakeTcpClientChannelMode(ClientData tcpSocket,
int mode);
+static void WrapNotify(ClientData clientData, int mask);
/*
* This structure describes the channel type structure for file based IO:
@@ -2215,8 +2216,13 @@ WrapNotify(
* in a writable condition, and only a readable state is reported
* present (see TcpWatchProc() below). In that case, signal back
* to the caller the writable state, which is really an error
- * condition.
+ * condition. As an extra check on that assumption, check for
+ * a non-zero value of errno before reporting an artificial
+ * writable state.
*/
+ if (errno == 0) {
+ return;
+ }
newmask = TCL_WRITABLE;
}
Tcl_NotifyChannel(statePtr->channel, newmask);