diff options
-rw-r--r-- | generic/tclIO.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 7d94037..0ed6018 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -3287,8 +3287,7 @@ Tcl_Close( stickyError = 0; - if ((statePtr->encoding != NULL) - && !(statePtr->outputEncodingFlags & TCL_ENCODING_START) + if ((statePtr->encoding != NULL) && (statePtr->curOutPtr != NULL) && (CheckChannelErrors(statePtr, TCL_WRITABLE) == 0)) { statePtr->outputEncodingFlags |= TCL_ENCODING_END; if (WriteChars(chanPtr, "", 0) < 0) { @@ -7709,8 +7708,7 @@ Tcl_SetChannelOption( * iso2022, the terminated escape sequence must write to the buffer. */ - if ((statePtr->encoding != NULL) - && !(statePtr->outputEncodingFlags & TCL_ENCODING_START) + if ((statePtr->encoding != NULL) && (statePtr->curOutPtr != NULL) && (CheckChannelErrors(statePtr, TCL_WRITABLE) == 0)) { statePtr->outputEncodingFlags |= TCL_ENCODING_END; WriteChars(chanPtr, "", 0); |