]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
file istream: If trying to seek backwards in unseekable stream, panic.
authorTimo Sirainen <tss@iki.fi>
Sun, 28 Feb 2010 11:38:43 +0000 (13:38 +0200)
committerTimo Sirainen <tss@iki.fi>
Sun, 28 Feb 2010 11:38:43 +0000 (13:38 +0200)
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

index 227269f42eb3a7944aa0c1db6636db6d84d72fe2..077eb20908a32c30988d2afd9b7b004290f38f45 100644 (file)
@@ -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;
        }