From: Timo Sirainen Date: Mon, 3 Jul 2023 10:40:36 +0000 (+0300) Subject: dbox: Add reason parameter to dbox_storage_vfuncs.set_file_corrupted() X-Git-Tag: 2.4.0~2470 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd22ec0fdc5a9adbf2bf8049cac68b065006d60a;p=thirdparty%2Fdovecot%2Fcore.git dbox: Add reason parameter to dbox_storage_vfuncs.set_file_corrupted() --- diff --git a/src/lib-storage/index/dbox-common/dbox-file.c b/src/lib-storage/index/dbox-common/dbox-file.c index a407e19396..6078e00aaa 100644 --- a/src/lib-storage/index/dbox-common/dbox-file.c +++ b/src/lib-storage/index/dbox-common/dbox-file.c @@ -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) diff --git a/src/lib-storage/index/dbox-common/dbox-storage.h b/src/lib-storage/index/dbox-common/dbox-storage.h index 814c3595c5..dbdeff91c8 100644 --- a/src/lib-storage/index/dbox-common/dbox-storage.h +++ b/src/lib-storage/index/dbox-common/dbox-storage.h @@ -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 { diff --git a/src/lib-storage/index/dbox-multi/mdbox-storage.c b/src/lib-storage/index/dbox-multi/mdbox-storage.c index d5a54a7a8c..0864e14dd4 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-storage.c +++ b/src/lib-storage/index/dbox-multi/mdbox-storage.c @@ -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); } diff --git a/src/lib-storage/index/dbox-multi/mdbox-storage.h b/src/lib-storage/index/dbox-multi/mdbox-storage.h index b9304febc1..383e61c14a 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-storage.h +++ b/src/lib-storage/index/dbox-multi/mdbox-storage.h @@ -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 diff --git a/src/lib-storage/index/dbox-single/sdbox-storage.c b/src/lib-storage/index/dbox-single/sdbox-storage.c index 45d5cfc26f..b9db237647 100644 --- a/src/lib-storage/index/dbox-single/sdbox-storage.c +++ b/src/lib-storage/index/dbox-single/sdbox-storage.c @@ -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); }