From 4ae354df6e08998137b527f495bfaaf3daf9eddc Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 28 Feb 2010 13:38:43 +0200 Subject: [PATCH] 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. --HG-- branch : HEAD --- src/lib/istream-file.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/istream-file.c b/src/lib/istream-file.c index 227269f42e..077eb20908 100644 --- a/src/lib/istream-file.c +++ b/src/lib/istream-file.c @@ -103,10 +103,8 @@ static void i_stream_file_seek(struct istream_private *stream, uoff_t v_offset, 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; } -- 2.47.3