changeset 12397:2a252c9cda5e

istream-tee: Fixed to work right when input stream didn't start from offset 0.
author Timo Sirainen <tss@iki.fi>
date Mon, 08 Nov 2010 18:30:05 +0000
parents 11169c6c6e8d
children 748e613fd73a
files src/lib/istream-tee.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/istream-tee.c	Mon Nov 08 18:03:07 2010 +0000
+++ b/src/lib/istream-tee.c	Mon Nov 08 18:30:05 2010 +0000
@@ -192,9 +192,12 @@
 	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;
 }