From: Phil Carmody Date: Wed, 30 Mar 2016 06:29:51 +0000 (+0300) Subject: lib: istream-concat - make cur_input always match input[cur_idx] X-Git-Tag: 2.3.0.rc1~1600 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13fc4d6d28f05076ffe6f5a925e8f6269e4b548e;p=thirdparty%2Fdovecot%2Fcore.git lib: istream-concat - make cur_input always match input[cur_idx] We're deliberately not stepping into the NULL stream, don't let the cur_idx indicate that we have moved into it, that's confusing. Signed-off-by: Phil Carmody --- diff --git a/src/lib/istream-concat.c b/src/lib/istream-concat.c index b414f3a8f8..291267f620 100644 --- a/src/lib/istream-concat.c +++ b/src/lib/istream-concat.c @@ -289,8 +289,10 @@ static void i_stream_concat_seek(struct istream_private *stream, return; } i_assert(cstream->cur_idx > 0); - cstream->cur_input = cstream->input[cstream->cur_idx-1]; - v_offset = cstream->input_size[cstream->cur_idx-1]; + /* Position ourselves at the EOF of the last actual stream. */ + cstream->cur_idx--; + cstream->cur_input = cstream->input[cstream->cur_idx]; + v_offset = cstream->input_size[cstream->cur_idx]; } i_stream_seek(cstream->cur_input, v_offset); }