summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-02-28 12:16:10 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-02-28 12:16:10 (GMT)
commit70e40dd53dda7e7fca32fc8aec28cf6504e7ffec (patch)
treed89bb4f3577597979193045d110166970e400746 /generic/tclIO.c
parentbb2f06fc739eb91a9f1499fbfbc4fa346172660e (diff)
downloadtcl-70e40dd53dda7e7fca32fc8aec28cf6504e7ffec.zip
tcl-70e40dd53dda7e7fca32fc8aec28cf6504e7ffec.tar.gz
tcl-70e40dd53dda7e7fca32fc8aec28cf6504e7ffec.tar.bz2
Restore previous behavior for non-blocking mode, as for this mode the semantics of [read]/[gets] were not broken. This was the 'some agreement'.
The change in line 8286 is necessary for both blocking and non-blocking mode: Whenver the encoding change we need to reset the CHANNEL_ENCODING_ERROR flag.
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index c96a406..ae09690 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -7588,6 +7588,10 @@ Tcl_Eof(
ChannelState *statePtr = ((Channel *) chan)->state;
/* State of real channel structure. */
+ if (GotFlag(statePtr, CHANNEL_NONBLOCKING)
+ && GotFlag(statePtr, CHANNEL_ENCODING_ERROR) {
+ return 0;
+ }
return GotFlag(statePtr, CHANNEL_EOF) ? 1 : 0;
}
@@ -8283,7 +8287,7 @@ Tcl_SetChannelOption(
statePtr->inputEncodingFlags = TCL_ENCODING_START;
statePtr->outputEncodingState = NULL;
statePtr->outputEncodingFlags = TCL_ENCODING_START;
- ResetFlag(statePtr, CHANNEL_NEED_MORE_DATA);
+ ResetFlag(statePtr, CHANNEL_NEED_MORE_DATA|CHANNEL_ENCODING_ERROR);
UpdateInterest(chanPtr);
return TCL_OK;
} else if (HaveOpt(2, "-eofchar")) {