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 /win | |
parent | f85de8a933413038cc1f868fb450de8daa02e676 (diff) | |
parent | c8c1298bb3b2b00caa2f412fd6947abd471e2891 (diff) | |
download | tcl-75b437e6967b190cf6effa5bfe5c49f698d75fd8.zip tcl-75b437e6967b190cf6effa5bfe5c49f698d75fd8.tar.gz tcl-75b437e6967b190cf6effa5bfe5c49f698d75fd8.tar.bz2 |
Merge 8.7
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinChan.c | 9 | ||||
-rw-r--r-- | win/tclWinSock.c | 30 |
2 files changed, 19 insertions, 20 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c index b08db5d..829cc74 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -85,8 +85,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 Tcl_WideInt FileWideSeekProc(ClientData instanceData, Tcl_WideInt offset, int mode, int *errorCode); static void FileSetupProc(ClientData clientData, int flags); @@ -108,7 +110,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, /* Set up the notifier to watch the channel. */ @@ -455,7 +461,7 @@ FileCloseProc( * *---------------------------------------------------------------------- */ - +#ifndef TCL_NO_DEPRECATED static int FileSeekProc( ClientData instanceData, /* File state. */ @@ -515,6 +521,7 @@ FileSeekProc( } return (int) newPos; } +#endif /* *---------------------------------------------------------------------- diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 61af337..8b42b9b 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1136,26 +1136,15 @@ 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 = SD_RECEIVE; - break; - case TCL_CLOSE_WRITE: - sd = SD_SEND; - 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); } /* @@ -1163,12 +1152,15 @@ TcpClose2Proc( * TCL_WRITABLE so this should never be called for a server socket. */ - if (shutdown(statePtr->sockets->fd, sd) == SOCKET_ERROR) { + if ((flags & TCL_CLOSE_READ) && (shutdown(statePtr->sockets->fd, SD_RECEIVE) == SOCKET_ERROR)) { TclWinConvertError((DWORD) WSAGetLastError()); - errorCode = Tcl_GetErrno(); + readError = Tcl_GetErrno(); } - - return errorCode; + if ((flags & TCL_CLOSE_WRITE) && (shutdown(statePtr->sockets->fd, SD_SEND) == SOCKET_ERROR)) { + TclWinConvertError((DWORD) WSAGetLastError()); + writeError = Tcl_GetErrno(); + } + return (readError != 0) ? readError : writeError; } /* |