Mercurial > dovecot > core-2.2
changeset 15910:b787cf83bca8
lib-storage: If mail saving is cancelled, don't check that all the input was read.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 24 Feb 2013 14:58:32 +0200 |
parents | f74bf0521d69 |
children | b0682d64a990 |
files | src/lib-storage/index/index-mail.c |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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)