[dovecot-cvs] dovecot/src/lib istream.c,1.23,1.24

cras at dovecot.org cras at dovecot.org
Tue Sep 7 17:23:04 EEST 2004


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv18524/lib

Modified Files:
	istream.c 
Log Message:
i_stream_read_data(): return -1 if we didn't read more data, even if buffer
has some.



Index: istream.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- istream.c	22 Aug 2004 11:23:33 -0000	1.23
+++ istream.c	7 Sep 2004 14:23:01 -0000	1.24
@@ -173,6 +173,7 @@
 		       size_t *size, size_t threshold)
 {
 	ssize_t ret = 0;
+	int read_more = FALSE;
 
 	do {
 		*data = i_stream_get_data(stream, size);
@@ -181,11 +182,13 @@
 
 		/* we need more data */
 		ret = i_stream_read(stream);
+		if (ret > 0)
+			read_more = TRUE;
 	} while (ret > 0);
 
 	*data = i_stream_get_data(stream, size);
 	return ret == -2 ? -2 :
-		*size > 0 || !stream->eof ? 0 : -1;
+		(read_more ? 0 : -1);
 }
 
 struct istream *_i_stream_create(struct _istream *_stream, pool_t pool, int fd,



More information about the dovecot-cvs mailing list