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

cras at dovecot.org cras at dovecot.org
Fri Jun 17 23:51:09 EEST 2005


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

Modified Files:
	istream-raw-mbox.c 
Log Message:
Fixed breakage caused by CRLF-support.



Index: istream-raw-mbox.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/istream-raw-mbox.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- istream-raw-mbox.c	14 Jun 2005 21:42:02 -0000	1.30
+++ istream-raw-mbox.c	17 Jun 2005 20:51:06 -0000	1.31
@@ -142,9 +142,15 @@
 	ret = 0;
 	do {
 		buf = i_stream_get_data(rstream->input, &pos);
-		if (pos > 1 &&
-		    stream->istream.v_offset + pos > rstream->input_peak_offset)
+		if (pos > 1 && stream->istream.v_offset + pos >
+		    rstream->input_peak_offset) {
+			/* fake our read count. needed because if in the end
+			   we have only one character in buffer and we skip it
+			   (as potential CR), we want to get back to this
+			   _read() to read more data. */
+			ret = pos;
 			break;
+		}
 		ret = i_stream_read(rstream->input);
 	} while (ret > 0);
 
@@ -263,6 +269,7 @@
 	if (new_pos == stream->pos) {
 		if (stream->istream.eof || ret > 0)
 			return _read(stream);
+		i_assert(new_pos > 0);
 		ret = -2;
 	} else {
 		i_assert(new_pos > stream->pos);



More information about the dovecot-cvs mailing list