diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-01-30 16:08:14 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-01-30 16:08:14 (GMT) |
commit | 75b437e6967b190cf6effa5bfe5c49f698d75fd8 (patch) | |
tree | 199c27e3a2e25a4165b758b605f3012159d5608e /unix | |
parent | f85de8a933413038cc1f868fb450de8daa02e676 (diff) | |
parent | c8c1298bb3b2b00caa2f412fd6947abd471e2891 (diff) | |
download | tcl-75b437e6967b190cf6effa5bfe5c49f698d75fd8.zip tcl-75b437e6967b190cf6effa5bfe5c49f698d75fd8.tar.gz tcl-75b437e6967b190cf6effa5bfe5c49f698d75fd8.tar.bz2 |
Merge 8.7
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tclUnixChan.c | 9 | ||||
-rw-r--r-- | unix/tclUnixSock.c | 30 |
2 files changed, 18 insertions, 21 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 5e757ee..56a0276 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -128,8 +128,10 @@ static int FileInputProc(ClientData instanceData, char *buf, int toRead, int *errorCode); static int FileOutputProc(ClientData instanceData, const char *buf, int toWrite, int *errorCode); +#ifndef TCL_NO_DEPRECATED static int FileSeekProc(ClientData instanceData, long offset, int mode, int *errorCode); +#endif static int FileTruncateProc(ClientData instanceData, Tcl_WideInt length); static Tcl_WideInt FileWideSeekProc(ClientData instanceData, @@ -164,7 +166,11 @@ static const Tcl_ChannelType fileChannelType = { FileCloseProc, /* Close proc. */ FileInputProc, /* Input proc. */ FileOutputProc, /* Output proc. */ +#ifndef TCL_NO_DEPRECATED FileSeekProc, /* Seek proc. */ +#else + NULL, +#endif NULL, /* Set option proc. */ NULL, /* Get option proc. */ FileWatchProc, /* Initialize notifier. */ @@ -432,7 +438,7 @@ TtyCloseProc( * *---------------------------------------------------------------------- */ - +#ifndef TCL_NO_DEPRECATED static int FileSeekProc( ClientData instanceData, /* File state. */ @@ -473,6 +479,7 @@ FileSeekProc( } return (int) newLoc; } +#endif /* *---------------------------------------------------------------------- diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 62e4756..57735da 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -686,32 +686,22 @@ TcpClose2Proc( int flags) /* Flags that indicate which side to close. */ { TcpState *statePtr = instanceData; - int errorCode = 0; - int sd; + int readError = 0; + int writeError = 0; /* * Shutdown the OS socket handle. */ - - switch(flags) { - case TCL_CLOSE_READ: - sd = SHUT_RD; - break; - case TCL_CLOSE_WRITE: - sd = SHUT_WR; - break; - default: - if (interp) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "socket close2proc called bidirectionally", -1)); - } - return TCL_ERROR; + if ((flags & (TCL_CLOSE_READ|TCL_CLOSE_WRITE)) == 0) { + return TcpCloseProc(instanceData, interp); } - if (shutdown(statePtr->fds.fd,sd) < 0) { - errorCode = errno; + if ((flags & TCL_CLOSE_READ) && (shutdown(statePtr->fds.fd, SHUT_RD) < 0)) { + readError = errno; } - - return errorCode; + if ((flags & TCL_CLOSE_WRITE) && (shutdown(statePtr->fds.fd, SHUT_WR) < 0)) { + writeError = errno; + } + return (readError != 0) ? readError : writeError; } /* |