diff options
Diffstat (limited to 'unix/tclUnixSock.c')
| -rw-r--r-- | unix/tclUnixSock.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index fcb508d..29defff 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -687,7 +687,8 @@ TcpClose2Proc( int flags) /* Flags that indicate which side to close. */ { TcpState *statePtr = instanceData; - int errorCode = 0; + int readError = 0; + int writeError = 0; /* * Shutdown the OS socket handle. @@ -696,12 +697,12 @@ TcpClose2Proc( return TcpCloseProc(instanceData, interp); } if ((flags & TCL_CLOSE_READ) && (shutdown(statePtr->fds.fd, SHUT_RD) < 0)) { - errorCode = errno; + readError = errno; } - if ((flags & TCL_CLOSE_WRITE) && (shutdown(statePtr->fds.fd, SHUT_WR) < 0) && (errorCode != 0)) { - errorCode = errno; + if ((flags & TCL_CLOSE_WRITE) && (shutdown(statePtr->fds.fd, SHUT_WR) < 0)) { + writeError = errno; } - return errorCode; + return (readError != 0) ? readError : writeError; } /* |
