]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
istream-tee: Fixed to work right when input stream didn't start from offset 0.
authorTimo Sirainen <tss@iki.fi>
Mon, 8 Nov 2010 18:30:05 +0000 (18:30 +0000)
committerTimo Sirainen <tss@iki.fi>
Mon, 8 Nov 2010 18:30:05 +0000 (18:30 +0000)
src/lib/istream-tee.c

index a126231594381fe43030edd9ea2c7b6f82cd92b5..bf5dea691f37dd9c7fdc49cb4d10a224eac234b4 100644 (file)
@@ -192,9 +192,12 @@ struct tee_istream *tee_i_stream_create(struct istream *input)
        struct tee_istream *tee;
 
        tee = i_new(struct tee_istream, 1);
-       tee->input = input;
-
-       i_stream_ref(input);
+       if (input->v_offset == 0) {
+               i_stream_ref(input);
+               tee->input = input;
+       } else {
+               tee->input = i_stream_create_limit(input, (uoff_t)-1);
+       }
        return tee;
 }