Skip to content

Commit

Permalink
sdbox: Delete .temp* files on when save/copy transaction is rolled back
Browse files Browse the repository at this point in the history
For example when copying was aborted due to user being over quota, temp
files were left behind.
  • Loading branch information
sirainen authored and villesavolainen committed Mar 16, 2018
1 parent 6242cf5 commit 3e65692
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib-storage/index/dbox-single/sdbox-save.c
Expand Up @@ -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);
Expand Down

0 comments on commit 3e65692

Please sign in to comment.