dovecot-2.0: file istream: If trying to seek backwards in unseek...

dovecot at dovecot.org dovecot at dovecot.org
Sun Feb 28 14:13:36 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/6e32dbc4cd8f
changeset: 10809:6e32dbc4cd8f
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Feb 28 13:38:43 2010 +0200
description:
file istream: If trying to seek backwards in unseekable stream, panic.
The previous way of just setting an error flag was getting ignored too
easily and causing silent corruption in such situations.

diffstat:

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

diffs (16 lines):

diff -r 0c3e147505f4 -r 6e32dbc4cd8f src/lib/istream-file.c
--- a/src/lib/istream-file.c	Thu Feb 25 09:54:12 2010 +0200
+++ b/src/lib/istream-file.c	Sun Feb 28 13:38:43 2010 +0200
@@ -103,10 +103,8 @@
 	struct file_istream *fstream = (struct file_istream *) stream;
 
 	if (!stream->istream.seekable) {
-		if (v_offset < stream->istream.v_offset) {
-			stream->istream.stream_errno = ESPIPE;
-			return;
-		}
+		if (v_offset < stream->istream.v_offset)
+			i_panic("stream doesn't support seeking backwards");
 		fstream->skip_left += v_offset - stream->istream.v_offset;
 	}
 


More information about the dovecot-cvs mailing list