summaryrefslogtreecommitdiffstats
path: root/win/tclWinChan.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-03-04 13:42:42 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-03-04 13:42:42 (GMT)
commit8defb7d10b69cdbe3219de6ae2dc169dc8df8bb9 (patch)
treed2f706832df81f622d3246731bef82f25668218a /win/tclWinChan.c
parenta4154b246b048a378dd83998031d103263856c8f (diff)
downloadtcl-8defb7d10b69cdbe3219de6ae2dc169dc8df8bb9.zip
tcl-8defb7d10b69cdbe3219de6ae2dc169dc8df8bb9.tar.gz
tcl-8defb7d10b69cdbe3219de6ae2dc169dc8df8bb9.tar.bz2
Implement WideSeekProc() for all channels which have a SeekProc(). Implement Close2Proc() for all channels, as minimal wrapper around CloseProc().
Backported (with comments) and adapted from core-8-branch.
Diffstat (limited to 'win/tclWinChan.c')
-rw-r--r--win/tclWinChan.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index b8016ec..54d0c84 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -76,6 +76,8 @@ static void FileChannelExitHandler(ClientData clientData);
static void FileCheckProc(ClientData clientData, int flags);
static int FileCloseProc(ClientData instanceData,
Tcl_Interp *interp);
+static int FileClose2Proc(ClientData instanceData,
+ Tcl_Interp *interp, int flags);
static int FileEventProc(Tcl_Event *evPtr, int flags);
static int FileGetHandleProc(ClientData instanceData,
int direction, ClientData *handlePtr);
@@ -111,7 +113,7 @@ static const Tcl_ChannelType fileChannelType = {
NULL, /* Get option proc. */
FileWatchProc, /* Set up the notifier to watch the channel. */
FileGetHandleProc, /* Get an OS handle from channel. */
- NULL, /* close2proc. */
+ FileClose2Proc, /* close2proc. */
FileBlockProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
@@ -360,7 +362,7 @@ FileBlockProc(
/*
*----------------------------------------------------------------------
*
- * FileCloseProc --
+ * FileCloseProc/FileClose2Proc --
*
* Closes the IO channel.
*
@@ -427,6 +429,18 @@ FileCloseProc(
ckfree(fileInfoPtr);
return errorCode;
}
+
+static int
+FileClose2Proc(
+ ClientData instanceData, /* Pointer to FileInfo structure. */
+ Tcl_Interp *interp, /* Not used. */
+ int flags)
+{
+ if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) {
+ return FileCloseProc(instanceData, interp);
+ }
+ return EINVAL;
+}
/*
*----------------------------------------------------------------------