[dovecot-cvs] dovecot/src/lib-storage/index/mbox istream-raw-mbox.c, 1.23, 1.24

cras at dovecot.org cras at dovecot.org
Thu Sep 2 18:55:39 EEST 2004


Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv4778/lib-storage/index/mbox

Modified Files:
	istream-raw-mbox.c 
Log Message:
Don't return -2 so easily in read()



Index: istream-raw-mbox.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/istream-raw-mbox.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- istream-raw-mbox.c	23 Aug 2004 07:01:49 -0000	1.23
+++ istream-raw-mbox.c	2 Sep 2004 15:55:37 -0000	1.24
@@ -119,6 +119,7 @@
 	time_t received_time;
 	size_t i, pos, new_pos, from_start_pos;
 	ssize_t ret = 0;
+	int tried_read = FALSE;
 
 	i_assert(stream->istream.v_offset >= rstream->from_offset);
 
@@ -145,6 +146,7 @@
 		    stream->istream.v_offset + pos > rstream->input_peak_offset)
 			break;
 		ret = i_stream_read(rstream->input);
+		tried_read = TRUE;
 	} while (ret > 0);
 
 	if (ret < 0) {
@@ -250,7 +252,7 @@
 
 	stream->buffer = buf;
 	if (new_pos == stream->pos) {
-		if (stream->istream.eof)
+		if (stream->istream.eof || !tried_read)
 			return _read(stream);
 		ret = -2;
 	} else {



More information about the dovecot-cvs mailing list