summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixSock.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2020-03-04 21:00:44 (GMT)
committerdgp <dgp@users.sourceforge.net>2020-03-04 21:00:44 (GMT)
commit0bee61f5cdb81ebd07d6d0d4f2874abc11554612 (patch)
treefa3d3570f8451cb6ed216ee27cad40fa14450751 /unix/tclUnixSock.c
parent9d172afc1bdfe94c2c66377b03fe8590ec83897b (diff)
parentdd7b6e22451427342c566bd331192a76a3d32d32 (diff)
downloadtcl-0bee61f5cdb81ebd07d6d0d4f2874abc11554612.zip
tcl-0bee61f5cdb81ebd07d6d0d4f2874abc11554612.tar.gz
tcl-0bee61f5cdb81ebd07d6d0d4f2874abc11554612.tar.bz2
merge 8.6
Diffstat (limited to 'unix/tclUnixSock.c')
-rw-r--r--unix/tclUnixSock.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index a9b8685..c94ee4e 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -627,12 +627,11 @@ TcpOutputProc(
static int
TcpCloseProc(
void *instanceData, /* The socket to close. */
- Tcl_Interp *dummy) /* For error reporting - unused. */
+ Tcl_Interp *interp) /* For error reporting */
{
TcpState *statePtr = (TcpState *)instanceData;
int errorCode = 0;
TcpFdList *fds;
- (void)dummy;
/*
* Delete a file handler that may be active for this socket if this is a
@@ -666,6 +665,9 @@ TcpCloseProc(
freeaddrinfo(statePtr->myaddrlist);
}
ckfree(statePtr);
+ if (interp && errorCode) {
+ Tcl_SetResult(interp, (char *)Tcl_PosixError(interp), TCL_STATIC);
+ }
return errorCode;
}
@@ -695,6 +697,7 @@ TcpClose2Proc(
TcpState *statePtr = (TcpState *)instanceData;
int readError = 0;
int writeError = 0;
+ int errorCode = 0;
/*
* Shutdown the OS socket handle.
@@ -708,7 +711,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;
}
/*