]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dbox: Add reason parameter to dbox_storage_vfuncs.set_file_corrupted()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 3 Jul 2023 10:40:36 +0000 (13:40 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 31 Jan 2024 11:41:42 +0000 (13:41 +0200)
src/lib-storage/index/dbox-common/dbox-file.c
src/lib-storage/index/dbox-common/dbox-storage.h
src/lib-storage/index/dbox-multi/mdbox-storage.c
src/lib-storage/index/dbox-multi/mdbox-storage.h
src/lib-storage/index/dbox-single/sdbox-storage.c

index 16810b0c34954179a9009031c2aab02fb083d1e0..5be9afa1bd3525ef42bae523ccfbdc5889429d28 100644 (file)
@@ -53,13 +53,11 @@ void dbox_file_set_corrupted(struct dbox_file *file, const char *reason, ...)
        va_list args;
 
        va_start(args, reason);
-       mail_storage_set_critical(&file->storage->storage,
+       file->storage->v.set_file_corrupted(file, t_strdup_printf(
                "Corrupted dbox file %s (around offset=%"PRIuUOFF_T"): %s",
                file->cur_path, file->input == NULL ? 0 : file->input->v_offset,
-               t_strdup_vprintf(reason, args));
+               t_strdup_vprintf(reason, args)));
        va_end(args);
-
-       file->storage->v.set_file_corrupted(file);
 }
 
 void dbox_file_init(struct dbox_file *file)
index 8e8aaa189976601844affaf345c9596c2d9e2eb8..4da88b566de51e1d519ecfcbddb0e870d117a229 100644 (file)
@@ -51,7 +51,7 @@ struct dbox_storage_vfuncs {
        /* mark the mailbox corrupted */
        void (*set_mailbox_corrupted)(struct mailbox *box);
        /* mark the file corrupted */
-       void (*set_file_corrupted)(struct dbox_file *file);
+       void (*set_file_corrupted)(struct dbox_file *file, const char *reason);
 };
 
 struct dbox_storage {
index c2250398eb1b5718c78adb00acb0e8cbfbb17309..283ef7a29a0137658e49ccfef996e9a7fc054bfa 100644 (file)
@@ -380,10 +380,11 @@ void mdbox_set_mailbox_corrupted(struct mailbox *box)
        mdbox_storage_set_corrupted(mstorage);
 }
 
-void mdbox_set_file_corrupted(struct dbox_file *file)
+void mdbox_set_file_corrupted(struct dbox_file *file, const char *reason)
 {
        struct mdbox_storage *mstorage = MDBOX_DBOX_STORAGE(file->storage);
 
+       mail_storage_set_critical(&mstorage->storage.storage, "%s", reason);
        mdbox_storage_set_corrupted(mstorage);
 }
 
index dbb6cfa7b05018bad4b696662b329011e771bf47..86cf407fbd752ea652965f13ecc094dd7d0cb29e 100644 (file)
@@ -113,6 +113,6 @@ int mdbox_mailbox_open(struct mailbox *box);
 
 void mdbox_storage_set_corrupted(struct mdbox_storage *storage);
 void mdbox_set_mailbox_corrupted(struct mailbox *box);
-void mdbox_set_file_corrupted(struct dbox_file *file);
+void mdbox_set_file_corrupted(struct dbox_file *file, const char *reason);
 
 #endif
index a25c325306b427df4bc0eb9442dc4cbe2bd15081..f1663d7628d6441dc180581688ce645f413de4a3 100644 (file)
@@ -305,10 +305,12 @@ void sdbox_set_mailbox_corrupted(struct mailbox *box)
                mbox->corrupted_rebuild_count = hdr.rebuild_count;
 }
 
-static void sdbox_set_file_corrupted(struct dbox_file *_file)
+static void sdbox_set_file_corrupted(struct dbox_file *_file,
+                                    const char *reason)
 {
        struct sdbox_file *file = (struct sdbox_file *)_file;
 
+       mail_storage_set_critical(&_file->storage->storage, "%s", reason);
        sdbox_set_mailbox_corrupted(&file->mbox->box);
 }