dovecot-1.1: istream-tee: Added some more asserts.

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 1 23:10:13 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.1/rev/3c08e376b0d1
changeset: 8230:3c08e376b0d1
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 01 16:09:58 2009 -0400
description:
istream-tee: Added some more asserts.

diffstat:

1 file changed, 3 insertions(+), 2 deletions(-)
src/lib/istream-tee.c |    5 +++--

diffs (23 lines):

diff -r 7ae55e4a6731 -r 3c08e376b0d1 src/lib/istream-tee.c
--- a/src/lib/istream-tee.c	Wed Apr 01 15:58:56 2009 -0400
+++ b/src/lib/istream-tee.c	Wed Apr 01 16:09:58 2009 -0400
@@ -123,9 +123,9 @@ static ssize_t i_stream_tee_read(struct 
 	   the parent stream without having to read more. */
 	last_high_offset = stream->istream.v_offset +
 		(stream->pos - stream->skip);
-	i_assert(last_high_offset <= input->v_offset + size);
-	if (last_high_offset == input->v_offset + size) {
+	if (stream->pos == size) {
 		/* we've read everything, need to read more */
+		i_assert(last_high_offset == input->v_offset + size);
 		tee_streams_skip(tstream->tee);
 		ret = i_stream_read(input);
 		if (ret <= 0) {
@@ -143,6 +143,7 @@ static ssize_t i_stream_tee_read(struct 
 		data = i_stream_get_data(input, &size);
 	} else {
 		/* there's still some data available from parent */
+		i_assert(last_high_offset < input->v_offset + size);
 		i_assert(stream->pos < size);
 		stream->buffer = data;
 	}


More information about the dovecot-cvs mailing list