summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2012-05-07 16:36:43 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2012-05-07 16:36:43 (GMT)
commitabdeb8de335b3ad784fed7e0338bcfc9cbd3d99e (patch)
tree37d41115d0b3d5efda1ea0a1f7a527dc61199cf9
parent4229e3c1ff708b65c55ee82c5fec89259c461d7b (diff)
downloadtcl-abdeb8de335b3ad784fed7e0338bcfc9cbd3d99e.zip
tcl-abdeb8de335b3ad784fed7e0338bcfc9cbd3d99e.tar.gz
tcl-abdeb8de335b3ad784fed7e0338bcfc9cbd3d99e.tar.bz2
Properly close nonblocking channels even when not flushing them.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclIO.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index fc7c245..7099611 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-04-28 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
+
+ * generic/tclIO.c: Properly close nonblocking channels even when
+ not flushing them.
+
2012-05-03 Jan Nijtmans <nijtmans@users.sf.net>
* compat/zlib/*: Upgrade to zlib 1.2.7 (pre-built dll is still 1.2.5,
diff --git a/generic/tclIO.c b/generic/tclIO.c
index b06c14d..86ee6ed 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -428,14 +428,15 @@ TclFinalizeIOSubsystem(void)
statePtr = statePtr->nextCSPtr) {
chanPtr = statePtr->topChanPtr;
if (!GotFlag(statePtr, CHANNEL_INCLOSE | CHANNEL_CLOSED | CHANNEL_DEAD)
- || (doflushnb && GotFlag(statePtr, BG_FLUSH_SCHEDULED))) {
+ || GotFlag(statePtr, BG_FLUSH_SCHEDULED)) {
+ ResetFlag(statePtr, BG_FLUSH_SCHEDULED);
active = 1;
break;
}
}
/*
- * We've found a live channel. Close it.
+ * We've found a live (or bg-closing) channel. Close it.
*/
if (active) {
@@ -479,7 +480,6 @@ TclFinalizeIOSubsystem(void)
* The refcount is greater than zero, so flush the channel.
*/
- ResetFlag(statePtr, BG_FLUSH_SCHEDULED);
Tcl_Flush((Tcl_Channel) chanPtr);
/*