[dovecot-cvs] dovecot/src/lib-index/mbox istream-mbox.c,1.4,1.5

cras at procontrol.fi cras at procontrol.fi
Wed Oct 29 16:58:42 EET 2003


Update of /home/cvs/dovecot/src/lib-index/mbox
In directory danu:/tmp/cvs-serv577/lib-index/mbox

Modified Files:
	istream-mbox.c 
Log Message:
fix



Index: istream-mbox.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/istream-mbox.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- istream-mbox.c	29 Oct 2003 13:37:33 -0000	1.4
+++ istream-mbox.c	29 Oct 2003 14:58:40 -0000	1.5
@@ -48,6 +48,7 @@
 {
 	struct mbox_istream *mstream = (struct mbox_istream *) stream;
 	ssize_t ret;
+	size_t pos;
 	uoff_t limit, old_limit;
 	off_t vsize_diff;
 
@@ -75,12 +76,18 @@
 	ret = i_stream_read(mstream->input);
 
 	mstream->istream.skip = 0;
-	mstream->istream.buffer =
-		i_stream_get_data(mstream->input, &mstream->istream.pos);
+	mstream->istream.buffer = i_stream_get_data(mstream->input, &pos);
+
+	if (pos == mstream->istream.pos)
+		ret = -1;
+	else {
+		ret = mstream->istream.pos - pos;
+                mstream->istream.pos = pos;
+	}
 
 	if (limit != old_limit)
 		i_stream_set_read_limit(mstream->input, old_limit);
-	return mstream->istream.pos == 0 ? -1 : (ssize_t)mstream->istream.pos;
+	return ret;
 }
 
 static void _seek(struct _istream *stream, uoff_t v_offset)



More information about the dovecot-cvs mailing list