From 6eb1232f227042df7308c275bf6d0966ff7587e8 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 12 Jun 2014 13:36:18 +0000 Subject: Additional check for an error condition on the socket. --- unix/tclUnixChan.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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); -- cgit v0.12