]> 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)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 30 Oct 2023 08:40:13 +0000 (08:40 +0000)
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 a407e19396a379eb936bf192481df711ca39618f..6078e00aaa8234ec5746b4cee3680ccbaf9947b8 100644 (file)
@@ -56,13 +56,11 @@ void dbox_file_set_corrupted(struct dbox_file *file, const char *reason, ...)
                return;
 
        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 814c3595c539e8b1b99df13652fbba993a70852e..dbdeff91c82524ebdeba60381f770fed722ff497 100644 (file)
@@ -52,7 +52,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 d5a54a7a8cc2ce9c4826a2ea271435725a0b41a4..0864e14dd477b18d990f11ce677de960a5647fed 100644 (file)
@@ -384,10 +384,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 b9304febc1ac824d28631e82bf965c1639de5f64..383e61c14ad48e9d3aed4723ecc2e59555f9a658 100644 (file)
@@ -114,6 +114,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 45d5cfc26fd54d8dc96c9055183391edc0198d85..b9db23764764336509476d3f28ca8b745dc81f0a 100644 (file)
@@ -304,8 +304,10 @@ 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)
 {
+       mail_storage_set_critical(&_file->storage->storage, "%s", reason);
        (void)dbox_file_fix(_file, 0);
 }