summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2008-12-18 16:52:53 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2008-12-18 16:52:53 (GMT)
commit404238ca7e941ab1baf288c6b14b1f5acdec0643 (patch)
tree01fdf68d3e35568dc304188d4cfc929ef170e07b
parentc61d3b006e4c4629bdd8962d0eb9c3f3596e539f (diff)
downloadtcl-404238ca7e941ab1baf288c6b14b1f5acdec0643.zip
tcl-404238ca7e941ab1baf288c6b14b1f5acdec0643.tar.gz
tcl-404238ca7e941ab1baf288c6b14b1f5acdec0643.tar.bz2
Add missing flush for half-close of the write side
-rw-r--r--generic/tclIO.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 3815c66..affa03b 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIO.c,v 1.155 2008/12/18 01:14:16 ferrieux Exp $
+ * RCS: @(#) $Id: tclIO.c,v 1.156 2008/12/18 16:52:53 ferrieux Exp $
*/
#include "tclInt.h"
@@ -3166,6 +3166,21 @@ Tcl_CloseEx(
return TCL_ERROR;
}
+ /*
+ * Flush any data if [close w]
+ */
+
+ if (flags & TCL_CLOSE_WRITE) {
+ if ((statePtr->curOutPtr != NULL) && IsBufferReady(statePtr->curOutPtr)) {
+ SetFlag(statePtr, BUFFER_READY);
+ }
+ /*
+ * Ignoring the outcome of the flush (like EPIPE), since we don't want
+ * to disrupt the close path with such errors
+ */
+ FlushChannel(NULL, chanPtr, 0);
+ }
+
/*
* Finally do what is asked of us.
*/