summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2015-04-29 18:16:36 (GMT)
committerdgp <dgp@users.sourceforge.net>2015-04-29 18:16:36 (GMT)
commit3b743160f6f21856fbb789aaccf8a1c25c563d2d (patch)
treeb40395da2161164ea89e14bd07e59f6b3ef8e672 /generic/tclIO.c
parentfd9d40cb5bb9f5a0afbb13c1c43cfed8a98fd4f8 (diff)
parent09d67aff952d446995a83642313ac2c780b92319 (diff)
downloadtcl-3b743160f6f21856fbb789aaccf8a1c25c563d2d.zip
tcl-3b743160f6f21856fbb789aaccf8a1c25c563d2d.tar.gz
tcl-3b743160f6f21856fbb789aaccf8a1c25c563d2d.tar.bz2
[894da183c8] Test and fix for regression in flushing blocked channels.
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index e46a22a..b97f57a 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -2657,6 +2657,8 @@ FlushChannel(
* the post-condition that on a successful return to caller we've
* left space in the current output buffer for more writing (the flush
* call was to make new room).
+ * If the channel is blocking, then yes, so we guarantee that
+ * blocking flushes actually flush all pending data.
* Otherwise, no. Keep the current output buffer where it is so more
* can be written to it, possibly filling it, to promote more efficient
* buffer usage.
@@ -2664,7 +2666,8 @@ FlushChannel(
bufPtr = statePtr->curOutPtr;
if (bufPtr && BytesLeft(bufPtr) && /* Keep empties off queue */
- (statePtr->outQueueHead == NULL || IsBufferFull(bufPtr))) {
+ (statePtr->outQueueHead == NULL || IsBufferFull(bufPtr)
+ || !GotFlag(statePtr, CHANNEL_NONBLOCKING))) {
if (statePtr->outQueueHead == NULL) {
statePtr->outQueueHead = bufPtr;
} else {