]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: istream-concat - make cur_input always match input[cur_idx]
authorPhil Carmody <phil@dovecot.fi>
Wed, 30 Mar 2016 06:29:51 +0000 (09:29 +0300)
committerPhil Carmody <phil@dovecot.fi>
Fri, 19 May 2017 07:34:33 +0000 (10:34 +0300)
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 <phil@dovecot.fi>
src/lib/istream-concat.c

index b414f3a8f807925486dd716b852e60d9e4511f45..291267f6205b59d232f6460550a01e935b9dbe4a 100644 (file)
@@ -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);
 }