Mercurial > dovecot > original-hg > dovecot-1.2
changeset 9547:578dcf893777 HEAD
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.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 28 Feb 2010 13:38:43 +0200 |
parents | 6c9f2ed821df |
children | 7c3b7c3a86ff |
files | src/lib/istream-file.c |
diffstat | 1 files changed, 2 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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; }