From: Timo Sirainen Date: Thu, 1 Mar 2018 10:17:16 +0000 (+0200) Subject: sdbox: Delete .temp* files on when save/copy transaction is rolled back X-Git-Tag: 2.2.35~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=da7fc275b56cd86bc8399882318fbec81eeb7a80;p=thirdparty%2Fdovecot%2Fcore.git 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. --- diff --git a/src/lib-storage/index/dbox-single/sdbox-save.c b/src/lib-storage/index/dbox-single/sdbox-save.c index 2a8a11088b..ed86367ad8 100644 --- a/src/lib-storage/index/dbox-single/sdbox-save.c +++ b/src/lib-storage/index/dbox-single/sdbox-save.c @@ -368,13 +368,16 @@ void sdbox_transaction_save_commit_post(struct mail_save_context *_ctx, "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);