]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
sdbox: Delete .temp* files on when save/copy transaction is rolled back
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 1 Mar 2018 10:17:16 +0000 (12:17 +0200)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Tue, 6 Mar 2018 07:38:44 +0000 (09:38 +0200)
For example when copying was aborted due to user being over quota, temp
files were left behind.

src/lib-storage/index/dbox-single/sdbox-save.c

index 7b914f8059020470d4fdb2f8f7f91732f63fc9dd..ee31390d62683e724b3a91b73fbe8b7e0e87c72a 100644 (file)
@@ -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 = SDBOX_SAVECTX(_ctx);
 
+       ctx->ctx.failed = TRUE;
        if (!ctx->ctx.finished)
                sdbox_save_cancel(_ctx);
        dbox_save_unref_files(ctx);