summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2015-04-29 18:00:15 (GMT)
committerdgp <dgp@users.sourceforge.net>2015-04-29 18:00:15 (GMT)
commitade6c2a049cda62730309d282fdf9c65a5daf1c4 (patch)
tree8359ded3f39de0ece97df1b7228183b607b06390 /generic/tclIO.c
parente9fd85d5d7cf2ac760a9d177e2d688172cbf9111 (diff)
parent08228c10689feab82a52980341ed6076e9b3abdc (diff)
downloadtcl-ade6c2a049cda62730309d282fdf9c65a5daf1c4.zip
tcl-ade6c2a049cda62730309d282fdf9c65a5daf1c4.tar.gz
tcl-ade6c2a049cda62730309d282fdf9c65a5daf1c4.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 2a20889..1b0d0ab 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -2556,6 +2556,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.
@@ -2563,7 +2565,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 {