dovecot-2.2: sdbox: Fix to handling transactions with partially ...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 29 17:55:54 EET 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/b99bead8b339
changeset: 15296:b99bead8b339
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Oct 03 01:38:20 2012 +0300
description:
sdbox: Fix to handling transactions with partially failed saves.

diffstat:

 src/lib-storage/index/dbox-single/sdbox-save.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 19732dd98602 -r b99bead8b339 src/lib-storage/index/dbox-single/sdbox-save.c
--- 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;


More information about the dovecot-cvs mailing list