dovecot-1.1: istream: Added one more assert to make sure return ...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 1 22:59:13 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.1/rev/7ae55e4a6731
changeset: 8229:7ae55e4a6731
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 01 15:58:56 2009 -0400
description:
istream: Added one more assert to make sure return value is correct.

diffstat:

1 file changed, 3 insertions(+), 1 deletion(-)
src/lib/istream.c |    4 +++-

diffs (28 lines):

diff -r 8b6b192498e3 -r 7ae55e4a6731 src/lib/istream.c
--- a/src/lib/istream.c	Wed Apr 01 12:50:11 2009 -0400
+++ b/src/lib/istream.c	Wed Apr 01 15:58:56 2009 -0400
@@ -67,6 +67,7 @@ ssize_t i_stream_read(struct istream *st
 ssize_t i_stream_read(struct istream *stream)
 {
 	struct istream_private *_stream = stream->real_stream;
+	size_t old_size;
 	ssize_t ret;
 
 	if (unlikely(stream->closed))
@@ -75,6 +76,7 @@ ssize_t i_stream_read(struct istream *st
 	stream->eof = FALSE;
 	stream->stream_errno = 0;
 
+	old_size = _stream->pos - _stream->skip;
 	ret = _stream->read(_stream);
 	switch (ret) {
 	case -2:
@@ -94,7 +96,7 @@ ssize_t i_stream_read(struct istream *st
 		break;
 	default:
 		i_assert(ret > 0);
-		i_assert((size_t)ret <= _stream->pos - _stream->skip);
+		i_assert((size_t)ret+old_size == _stream->pos - _stream->skip);
 		break;
 	}
 	return ret;


More information about the dovecot-cvs mailing list