]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mdbox: Fix crash still if fdatasync_path() fails
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 22 Jun 2023 07:48:13 +0000 (10:48 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 1 Sep 2023 10:58:30 +0000 (13:58 +0300)
Broken still in a8424a71d70e2f5c54d9e2aab8338cf9547b15b4

src/lib-storage/index/dbox-multi/mdbox-save.c

index fdffbbf22dc509704d8abefd3f265807dd2ad306..268f77c7218d8ba3134e091752d1eaae4df43102 100644 (file)
@@ -374,7 +374,8 @@ void mdbox_transaction_save_commit_post(struct mail_save_context *_ctx,
                                        struct mail_index_transaction_commit_result *result)
 {
        struct mdbox_save_context *ctx = MDBOX_SAVECTX(_ctx);
-       struct mail_storage *_storage = _ctx->transaction->box->storage;
+       struct mailbox *box = _ctx->transaction->box;
+       struct mail_storage *_storage = box->storage;
        struct mdbox_storage *storage =
                container_of(_storage, struct mdbox_storage, storage.storage);
 
@@ -401,7 +402,7 @@ void mdbox_transaction_save_commit_post(struct mail_save_context *_ctx,
 
        if (_storage->set->parsed_fsync_mode != FSYNC_MODE_NEVER) {
                if (fdatasync_path(storage->storage_dir) < 0) {
-                       mailbox_set_critical(_ctx->transaction->box,
+                       mailbox_set_critical(box,
                                "fdatasync_path(%s) failed: %m",
                                storage->storage_dir);
                }