]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
i_stream_read_data(): Error handling fixes.
authorTimo Sirainen <tss@iki.fi>
Sat, 13 Sep 2008 09:22:30 +0000 (12:22 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 13 Sep 2008 09:22:30 +0000 (12:22 +0300)
--HG--
branch : HEAD

src/lib/istream.c

index 0e861df79aaf376847550ba4f20215981fd0465d..8cc803d3d39d6dfb7c65a86b497c78b66680d27a 100644 (file)
@@ -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;
 }