dovecot-2.2: lib-storage: MAIL_FETCH_BODY_SNIPPET should seek th...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jan 19 19:59:42 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/50514ef4f138
changeset: 18169:50514ef4f138
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jan 19 21:53:00 2015 +0200
description:
lib-storage: MAIL_FETCH_BODY_SNIPPET should seek the mail stream back to original position.

diffstat:

 src/lib-storage/index/index-mail.c |  4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diffs (28 lines):

diff -r b03b1369410d -r 50514ef4f138 src/lib-storage/index/index-mail.c
--- a/src/lib-storage/index/index-mail.c	Mon Jan 19 21:52:21 2015 +0200
+++ b/src/lib-storage/index/index-mail.c	Mon Jan 19 21:53:00 2015 +0200
@@ -905,6 +905,7 @@
 {
 	struct message_part *part;
 	struct istream *input;
+	uoff_t old_offset;
 	string_t *str;
 	int ret;
 
@@ -916,6 +917,7 @@
 		return 0;
 	}
 
+	old_offset = mail->data.stream == NULL ? 0 : mail->data.stream->v_offset;
 	if (mail_get_stream(&mail->mail.mail, NULL, NULL, &input) < 0)
 		return -1;
 	i_stream_seek(input, part->physical_pos);
@@ -928,6 +930,8 @@
 	if (ret == 0)
 		mail->data.body_snippet = str_c(str);
 	i_stream_destroy(&input);
+
+	i_stream_seek(mail->data.stream, old_offset);
 	return ret;
 }
 


More information about the dovecot-cvs mailing list