dovecot-2.2: lib-storage: If mail saving is cancelled, don't che...

dovecot at dovecot.org dovecot at dovecot.org
Sun Feb 24 14:58:46 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/b787cf83bca8
changeset: 15910:b787cf83bca8
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Feb 24 14:58:32 2013 +0200
description:
lib-storage: If mail saving is cancelled, don't check that all the input was read.

diffstat:

 src/lib-storage/index/index-mail.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (43 lines):

diff -r f74bf0521d69 -r b787cf83bca8 src/lib-storage/index/index-mail.c
--- a/src/lib-storage/index/index-mail.c	Sun Feb 24 11:58:46 2013 +0200
+++ b/src/lib-storage/index/index-mail.c	Sun Feb 24 14:58:32 2013 +0200
@@ -802,8 +802,9 @@
 		(void)index_mail_cache_sent_date(mail);
 }
 
-static int index_mail_parse_body_finish(struct index_mail *mail,
-					enum index_cache_field field)
+static int
+index_mail_parse_body_finish(struct index_mail *mail,
+			     enum index_cache_field field, bool success)
 {
 	struct istream *parser_input = mail->data.parser_input;
 	int ret;
@@ -820,7 +821,8 @@
 		    parser_input->stream_errno == EPIPE) {
 			/* EPIPE = input already closed. allow the caller to
 			   decide if that is an error or not. */
-			i_assert(i_stream_read(parser_input) == -1 &&
+			i_assert(!success ||
+				 i_stream_read(parser_input) == -1 &&
 				 !i_stream_have_bytes_left(parser_input));
 		} else {
 			errno = parser_input->stream_errno;
@@ -897,7 +899,7 @@
 			*null_message_part_header_callback, (void *)NULL);
 	}
 	ret = index_mail_stream_check_failure(mail);
-	if (index_mail_parse_body_finish(mail, field) < 0)
+	if (index_mail_parse_body_finish(mail, field, TRUE) < 0)
 		ret = -1;
 
 	i_stream_seek(data->stream, old_offset);
@@ -1693,7 +1695,7 @@
 
 	mail->data.save_bodystructure_body = FALSE;
 	mail->data.parsed_bodystructure = TRUE;
-	(void)index_mail_parse_body_finish(mail, 0);
+	(void)index_mail_parse_body_finish(mail, 0, success);
 }
 
 static void index_mail_drop_recent_flag(struct mail *mail)


More information about the dovecot-cvs mailing list