From f572d15108ea68aef3ff8e2c3de3899f8a50f25f Mon Sep 17 00:00:00 2001 From: andreas_kupries Date: Tue, 10 Jun 2008 03:35:15 +0000 Subject: * generic/tclIORTrans.c (ReflectInput): Fixed a bug triggered by Pat Thoyts . 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. --- ChangeLog | 12 ++++++++++++ generic/tclIORTrans.c | 9 ++++++--- 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 + + * generic/tclIORTrans.c (ReflectInput): Fixed a bug triggered by + Pat Thoyts . 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 * 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 @@ -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 */ -- cgit v0.12