changeset 8194:1ee313158639 HEAD

i_stream_read_data(): Error handling fixes.
author Timo Sirainen <tss@iki.fi>
date Sat, 13 Sep 2008 12:22:30 +0300
parents b3fb8215a339
children 413c70b0ae1d
files src/lib/istream.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/istream.c	Sat Sep 13 11:56:16 2008 +0300
+++ b/src/lib/istream.c	Sat Sep 13 12:22:30 2008 +0300
@@ -290,10 +290,16 @@
 	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;
 }