summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixChan.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/tclUnixChan.c')
-rw-r--r--unix/tclUnixChan.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 27f2710..2df7b28 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -99,6 +99,8 @@ typedef struct TtyAttrs {
static int FileBlockModeProc(ClientData instanceData, int mode);
static int FileCloseProc(ClientData instanceData,
Tcl_Interp *interp);
+static int FileClose2Proc(ClientData instanceData,
+ Tcl_Interp *interp, int flags);
static int FileGetHandleProc(ClientData instanceData,
int direction, ClientData *handlePtr);
static int FileInputProc(ClientData instanceData, char *buf,
@@ -144,7 +146,7 @@ static const Tcl_ChannelType fileChannelType = {
NULL, /* Get option proc. */
FileWatchProc, /* Initialize notifier. */
FileGetHandleProc, /* Get OS handles out of channel. */
- NULL, /* close2proc. */
+ FileClose2Proc, /* close2proc. */
FileBlockModeProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
@@ -170,7 +172,7 @@ static const Tcl_ChannelType ttyChannelType = {
TtyGetOptionProc, /* Get option proc. */
FileWatchProc, /* Initialize notifier. */
FileGetHandleProc, /* Get OS handles out of channel. */
- NULL, /* close2proc. */
+ FileClose2Proc, /* close2proc. */
FileBlockModeProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
@@ -347,6 +349,17 @@ FileCloseProc(
ckfree(fsPtr);
return errorCode;
}
+static int
+FileClose2Proc(
+ ClientData instanceData, /* File state. */
+ Tcl_Interp *interp, /* For error reporting - unused. */
+ int flags)
+{
+ if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) {
+ return FileCloseProc(instanceData, interp);
+ }
+ return EINVAL;
+}
/*
*----------------------------------------------------------------------