summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2008-06-10 03:35:15 (GMT)
committerandreas_kupries <akupries@shaw.ca>2008-06-10 03:35:15 (GMT)
commitf572d15108ea68aef3ff8e2c3de3899f8a50f25f (patch)
tree952477ba27e0508e4801d0d507e7d9475fdfe5aa
parent903ca7048a4ab89a4962196a979014681d5db909 (diff)
downloadtcl-f572d15108ea68aef3ff8e2c3de3899f8a50f25f.zip
tcl-f572d15108ea68aef3ff8e2c3de3899f8a50f25f.tar.gz
tcl-f572d15108ea68aef3ff8e2c3de3899f8a50f25f.tar.bz2
* generic/tclIORTrans.c (ReflectInput): Fixed a bug triggered by
Pat Thoyts <patthoyts@users.sourceforge.net>. Reset the EOF flag after draining the Tcl level into the result buffer, to make sure that the result buffer will be drained as well by repeated calls to ReflectInput should it contain more than one buffer-full of data. Without that reset the higher I/O system will not call on ReflectInput anymore due to the assumed EOF, thus losing the data which did not fit in the buffer of the call which caused the eof and drain.
-rw-r--r--ChangeLog12
-rw-r--r--generic/tclIORTrans.c9
2 files changed, 18 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 0af84d6..dce1163 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-06-09 Andreas Kupries <akupries@shaw.ca>
+
+ * generic/tclIORTrans.c (ReflectInput): Fixed a bug triggered by
+ Pat Thoyts <patthoyts@users.sourceforge.net>. Reset the EOF flag
+ after draining the Tcl level into the result buffer, to make sure
+ that the result buffer will be drained as well by repeated calls
+ to ReflectInput should it contain more than one buffer-full of
+ data. Without that reset the higher I/O system will not call on
+ ReflectInput anymore due to the assumed EOF, thus losing the data
+ which did not fit in the buffer of the call which caused the eof
+ and drain.
+
2008-06-09 Donal K. Fellows <dkf@users.sf.net>
* generic/tclOOCall.c (TclOOGetSortedMethodList): Plug memory leak
diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c
index 908c480..c309afc 100644
--- a/generic/tclIORTrans.c
+++ b/generic/tclIORTrans.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIORTrans.c,v 1.1 2008/06/06 19:46:37 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclIORTrans.c,v 1.2 2008/06/10 03:35:16 andreas_kupries Exp $
*/
#include <tclInt.h>
@@ -1065,8 +1065,8 @@ ReflectInput(
/*
* The buffer is exhausted, but the caller wants even more. We now
* have to go to the underlying channel, get more bytes and then
- * transform them for delivery. We may not get that we want (full EOF
- * or temporary out of data).
+ * transform them for delivery. We may not get what we want (full EOF
+ * or temporarily out of data).
*/
/*
@@ -1158,6 +1158,9 @@ ReflectInput(
/* The drain delivered nothing */
return gotBytes;
}
+
+ /* Reset eof, force caller to drain result buffer */
+ ((Channel*) rtPtr->parent)->state->flags &= ~CHANNEL_EOF;
continue; /* at: while (toRead > 0) */
}
} /* read == 0 */