Mercurial > dovecot > core-2.2
changeset 15296:b99bead8b339
sdbox: Fix to handling transactions with partially failed saves.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 03 Oct 2012 01:38:20 +0300 |
parents | 19732dd98602 |
children | 12606087a774 |
files | src/lib-storage/index/dbox-single/sdbox-save.c |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-single/sdbox-save.c Wed Oct 03 01:26:42 2012 +0300 +++ b/src/lib-storage/index/dbox-single/sdbox-save.c Wed Oct 03 01:38:20 2012 +0300 @@ -168,7 +168,7 @@ static int dbox_save_finish_write(struct mail_save_context *_ctx) { struct sdbox_save_context *ctx = (struct sdbox_save_context *)_ctx; - struct dbox_file *const *files; + struct dbox_file **files; ctx->ctx.finished = TRUE; if (ctx->ctx.dbox_output == NULL) @@ -192,14 +192,17 @@ if (ctx->ctx.failed) { mail_index_expunge(ctx->ctx.trans, ctx->ctx.seq); dbox_file_append_rollback(&ctx->append_ctx); + dbox_file_unlink(*files); + dbox_file_unref(files); + array_delete(&ctx->files, array_count(&ctx->files) - 1, 1); } else { dbox_file_append_checkpoint(ctx->append_ctx); if (dbox_file_append_commit(&ctx->append_ctx) < 0) ctx->ctx.failed = TRUE; + dbox_file_close(*files); } i_stream_unref(&ctx->ctx.input); - dbox_file_close(*files); ctx->ctx.dbox_output = NULL; return ctx->ctx.failed ? -1 : 0;