From: Timo Sirainen Date: Sat, 13 Sep 2008 09:22:30 +0000 (+0300) Subject: i_stream_read_data(): Error handling fixes. X-Git-Tag: 1.2.alpha2~54 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=90b8f131849540fa374aede95edd86d47d35c09d;p=thirdparty%2Fdovecot%2Fcore.git i_stream_read_data(): Error handling fixes. --HG-- branch : HEAD --- diff --git a/src/lib/istream.c b/src/lib/istream.c index 0e861df79a..8cc803d3d3 100644 --- a/src/lib/istream.c +++ b/src/lib/istream.c @@ -290,10 +290,16 @@ int i_stream_read_data(struct istream *stream, const unsigned char **data_r, if (ret == -2) return -2; - if (read_more || ret == 0) { - i_assert(!stream->blocking || stream->eof); + if (ret == 0) { + /* need to read more */ + i_assert(!stream->blocking); return 0; } + if (read_more && stream->eof) { + /* we read at least some new data */ + return 0; + } + i_assert(stream->stream_errno != 0); return -1; }