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

dovecot at dovecot.org dovecot at dovecot.org
Sun Feb 28 16:21:27 EET 2010


details:   http://hg.dovecot.org/dovecot-1.2/rev/578dcf893777
changeset: 9547:578dcf893777
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 6c9f2ed821df -r 578dcf893777 src/lib/istream-file.c
--- a/src/lib/istream-file.c	Sun Feb 28 16:20:46 2010 +0200
+++ b/src/lib/istream-file.c	Sun Feb 28 13:38:43 2010 +0200
@@ -110,10 +110,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