changeset 22888:2934b16c4b5b

sdbox: Delete .temp* files on when save/copy transaction is rolled back For example when copying was aborted due to user being over quota, temp files were left behind.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 01 Mar 2018 12:17:16 +0200
parents 075c48f8ffb5
children 51c7b591cd20
files src/lib-storage/index/dbox-single/sdbox-save.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-single/sdbox-save.c	Fri Dec 22 18:58:11 2017 +0200
+++ b/src/lib-storage/index/dbox-single/sdbox-save.c	Thu Mar 01 12:17:16 2018 +0200
@@ -368,13 +368,16 @@
 				"fdatasync_path(%s) failed: %m", box_path);
 		}
 	}
-	sdbox_transaction_save_rollback(_ctx);
+	i_assert(ctx->ctx.finished);
+	dbox_save_unref_files(ctx);
+	i_free(ctx);
 }
 
 void sdbox_transaction_save_rollback(struct mail_save_context *_ctx)
 {
 	struct sdbox_save_context *ctx = (struct sdbox_save_context *)_ctx;
 
+	ctx->ctx.failed = TRUE;
 	if (!ctx->ctx.finished)
 		sdbox_save_cancel(_ctx);
 	dbox_save_unref_files(ctx);