]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Rollback save transaction when transaction commit fails.
authorsergey.kitov <sergey.kitov@open-xchange.com>
Wed, 12 Apr 2023 09:06:52 +0000 (12:06 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Thu, 15 Jun 2023 17:22:32 +0000 (17:22 +0000)
src/lib-storage/index/index-transaction.c

index edd6c3f4bb951136fdc5a0e9af03102d08aec3a5..e3138b690880d63fd55898ea76ef20f530de5a73 100644 (file)
@@ -76,9 +76,12 @@ index_transaction_index_commit(struct mail_index_transaction *index_trans,
                }
        }
 
-       if (t->save_ctx != NULL) {
+       if (t->save_ctx == NULL) {
+       } else if (ret >= 0) {
                i_assert(t->save_ctx->dest_mail == NULL);
                t->box->v.transaction_save_commit_post(t->save_ctx, result_r);
+       } else {
+               t->box->v.transaction_save_rollback(t->save_ctx);
        }
 
        if (pvt_sync_ctx != NULL) {