diff options
author | dgp <dgp@users.sourceforge.net> | 2020-03-04 20:50:38 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2020-03-04 20:50:38 (GMT) |
commit | dd7b6e22451427342c566bd331192a76a3d32d32 (patch) | |
tree | f0954de866f726eb5eceece266e7228d0c7768e4 /unix | |
parent | 167bc4d8e750ec782ba2da35dc08e0605028b9c9 (diff) | |
download | tcl-dd7b6e22451427342c566bd331192a76a3d32d32.zip tcl-dd7b6e22451427342c566bd331192a76a3d32d32.tar.gz tcl-dd7b6e22451427342c566bd331192a76a3d32d32.tar.bz2 |
The close routines of the "tcp" channel type were failing to record error
messages and error codes.
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tclUnixSock.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index a00559a..0dd8e86 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -631,6 +631,9 @@ TcpCloseProc( freeaddrinfo(statePtr->myaddrlist); } ckfree(statePtr); + if (interp && errorCode) { + Tcl_SetResult(interp, (char *)Tcl_PosixError(interp), TCL_STATIC); + } return errorCode; } @@ -660,6 +663,7 @@ TcpClose2Proc( TcpState *statePtr = instanceData; int readError = 0; int writeError = 0; + int errorCode = 0; /* * Shutdown the OS socket handle. @@ -673,7 +677,12 @@ TcpClose2Proc( if ((flags & TCL_CLOSE_WRITE) && (shutdown(statePtr->fds.fd, SHUT_WR) < 0)) { writeError = errno; } - return (readError != 0) ? readError : writeError; + + errorCode = (readError != 0) ? readError : writeError; + if (interp && errorCode) { + Tcl_SetResult(interp, (char *)Tcl_PosixError(interp), TCL_STATIC); + } + return errorCode; } /* |