]> 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)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 13 Mar 2018 04:33:59 +0000 (06:33 +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 2a8a11088b6201ce9a8080efb2652a86667288ff..ed86367ad8cde65035310d2db11a5bd0e9c57c81 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 = (struct sdbox_save_context *)_ctx;
 
+       ctx->ctx.failed = TRUE;
        if (!ctx->ctx.finished)
                sdbox_save_cancel(_ctx);
        dbox_save_unref_files(ctx);