changeset 6720:e1ec38002b2b HEAD

i_stream_read_next_line(): Try to read the next line until we get it or i_stream_read() fails.
author Timo Sirainen <tss@iki.fi>
date Wed, 07 Nov 2007 05:46:45 +0200
parents 1efa924b134b
children 9aab8ac958fb
files src/lib/istream.c
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/istream.c	Wed Nov 07 01:30:38 2007 +0200
+++ b/src/lib/istream.c	Wed Nov 07 05:46:45 2007 +0200
@@ -196,12 +196,14 @@
 {
 	char *line;
 
-	line = i_stream_next_line(stream);
-	if (line != NULL)
-		return line;
+	for (;;) {
+		line = i_stream_next_line(stream);
+		if (line != NULL)
+			break;
 
-	if (i_stream_read(stream) > 0)
-		line = i_stream_next_line(stream);
+		if (i_stream_read(stream) <= 0)
+			return NULL;
+	}
 	return line;
 }