Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5963:9bef18690777 HEAD
Cache updater might not have seen all the input data producing broken data.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 12 Jul 2007 06:12:44 +0300 |
parents | 3e01ee1a2864 |
children | 29d08e7bbf63 |
files | src/lib-storage/index/cydir/cydir-save.c src/lib-storage/index/maildir/maildir-save.c |
diffstat | 2 files changed, 30 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/cydir/cydir-save.c Thu Jul 12 05:51:03 2007 +0300 +++ b/src/lib-storage/index/cydir/cydir-save.c Thu Jul 12 06:12:44 2007 +0300 @@ -148,17 +148,22 @@ if (ctx->failed) return -1; - index_mail_cache_parse_continue(ctx->cur_dest_mail); + do { + index_mail_cache_parse_continue(ctx->cur_dest_mail); - if (o_stream_send_istream(ctx->output, ctx->input) < 0) { - if (!mail_storage_set_error_from_errno(storage)) { - mail_storage_set_critical(storage, - "o_stream_send_istream(%s) failed: %m", - cydir_get_save_path(ctx, ctx->mail_count)); + if (o_stream_send_istream(ctx->output, ctx->input) < 0) { + if (!mail_storage_set_error_from_errno(storage)) { + mail_storage_set_critical(storage, + "o_stream_send_istream(%s) failed: %m", + cydir_get_save_path(ctx, ctx->mail_count)); + } + ctx->failed = TRUE; + return -1; } - ctx->failed = TRUE; - return -1; - } + /* both input and input2 readers may consume data from our + primary input stream. we'll have to handle all the data + here. */ + } while (i_stream_read(ctx->input2) > 0); return 0; }
--- a/src/lib-storage/index/maildir/maildir-save.c Thu Jul 12 05:51:03 2007 +0300 +++ b/src/lib-storage/index/maildir/maildir-save.c Thu Jul 12 06:12:44 2007 +0300 @@ -449,18 +449,23 @@ if (ctx->failed) return -1; - if (ctx->cur_dest_mail != NULL) - index_mail_cache_parse_continue(ctx->cur_dest_mail); - - if (o_stream_send_istream(ctx->output, ctx->input) < 0) { - if (!mail_storage_set_error_from_errno(storage)) { - mail_storage_set_critical(storage, - "o_stream_send_istream(%s/%s) failed: %m", - ctx->tmpdir, ctx->file_last->basename); + do { + if (ctx->cur_dest_mail != NULL) + index_mail_cache_parse_continue(ctx->cur_dest_mail); + if (o_stream_send_istream(ctx->output, ctx->input) < 0) { + if (!mail_storage_set_error_from_errno(storage)) { + mail_storage_set_critical(storage, + "o_stream_send_istream(%s/%s) " + "failed: %m", + ctx->tmpdir, ctx->file_last->basename); + } + ctx->failed = TRUE; + return -1; } - ctx->failed = TRUE; - return -1; - } + /* both input and input2 readers may consume data from our + primary input stream. we'll have to handle all the data + here. */ + } while (i_stream_read(ctx->input2) > 0); return 0; }