dovecot: Seek also non-seekable parent streams to current offset...

dovecot at dovecot.org dovecot at dovecot.org
Sat Mar 1 00:15:42 EET 2008


details:   http://hg.dovecot.org/dovecot/rev/29a6eec987e5
changeset: 7306:29a6eec987e5
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Mar 01 00:15:30 2008 +0200
description:
Seek also non-seekable parent streams to current offset as long as we're not
seeking backwards.

diffstat:

1 file changed, 6 insertions(+), 4 deletions(-)
src/lib/istream-limit.c |   10 ++++++----

diffs (22 lines):

diff -r e4aa76ca2bc5 -r 29a6eec987e5 src/lib/istream-limit.c
--- a/src/lib/istream-limit.c	Fri Feb 29 11:21:07 2008 +0200
+++ b/src/lib/istream-limit.c	Sat Mar 01 00:15:30 2008 +0200
@@ -12,12 +12,14 @@ static void i_stream_limit_destroy(struc
 static void i_stream_limit_destroy(struct iostream_private *stream)
 {
 	struct limit_istream *lstream = (struct limit_istream *) stream;
+	uoff_t v_offset;
 
-	if (lstream->istream.parent->seekable) {
+	v_offset = lstream->istream.parent_start_offset +
+		lstream->istream.istream.v_offset;
+	if (lstream->istream.parent->seekable ||
+	    v_offset > lstream->istream.parent->v_offset) {
 		/* get to same position in parent stream */
-		i_stream_seek(lstream->istream.parent,
-			      lstream->istream.parent_start_offset +
-			      lstream->istream.istream.v_offset);
+		i_stream_seek(lstream->istream.parent, v_offset);
 	}
 	i_stream_unref(&lstream->istream.parent);
 }


More information about the dovecot-cvs mailing list