]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-fs: ostream-metawrap: Fixed o_stream_send_istream() offset updates
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 18 May 2016 14:56:55 +0000 (17:56 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 18 May 2016 15:43:56 +0000 (18:43 +0300)
src/lib-fs/ostream-metawrap.c

index cd640a7ed793b5a04ae351ec74c6b9f98764c35a..08cd4caed34dd03dcad117bbbbcfdcaedda52076 100644 (file)
@@ -1,6 +1,7 @@
 /* Copyright (c) 2013-2016 Dovecot authors, see the included COPYING file */
 
 #include "lib.h"
+#include "istream.h"
 #include "ostream-private.h"
 #include "ostream-metawrap.h"
 
@@ -43,14 +44,13 @@ o_stream_metawrap_send_istream(struct ostream_private *_outstream,
 {
        struct metawrap_ostream *outstream =
                (struct metawrap_ostream *)_outstream;
-       uoff_t orig_outstream_offset = _outstream->ostream.offset;
+       uoff_t orig_instream_offset = instream->v_offset;
        int ret;
 
        o_stream_metawrap_call_callback(outstream);
        if ((ret = o_stream_send_istream(_outstream->parent, instream)) < 0)
                o_stream_copy_error_from_parent(_outstream);
-       _outstream->ostream.offset +=
-               _outstream->ostream.offset - orig_outstream_offset;
+       _outstream->ostream.offset += instream->v_offset - orig_instream_offset;
        return ret;
 }