summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorferrieux@users.sourceforge.net <ferrieux>2008-12-18 16:52:53 (GMT)
committerferrieux@users.sourceforge.net <ferrieux>2008-12-18 16:52:53 (GMT)
commit57d373a1b6fac5eaa60dc4fe7e23c19c47a1a487 (patch)
tree01fdf68d3e35568dc304188d4cfc929ef170e07b /generic
parent8bb74393dd1975e3c32565f6ab4d0d5a08276f6e (diff)
downloadtcl-57d373a1b6fac5eaa60dc4fe7e23c19c47a1a487.zip
tcl-57d373a1b6fac5eaa60dc4fe7e23c19c47a1a487.tar.gz
tcl-57d373a1b6fac5eaa60dc4fe7e23c19c47a1a487.tar.bz2
Add missing flush for half-close of the write side
Diffstat (limited to 'generic')
-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.
*/