From: Timo Sirainen Date: Mon, 21 Aug 2017 12:34:40 +0000 (+0300) Subject: lib-storage: Add mail_storage_set_index_error() X-Git-Tag: 2.2.33.rc1~103 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0991c15293982926c4c727eef08cee86d8b037cf;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Add mail_storage_set_index_error() --- diff --git a/src/lib-storage/mail-storage-private.h b/src/lib-storage/mail-storage-private.h index 25e5c672d4..f230041ecf 100644 --- a/src/lib-storage/mail-storage-private.h +++ b/src/lib-storage/mail-storage-private.h @@ -736,6 +736,8 @@ void mail_storage_set_critical(struct mail_storage *storage, const char *fmt, ...) ATTR_FORMAT(2, 3); void mail_storage_set_internal_error(struct mail_storage *storage); void mailbox_set_index_error(struct mailbox *box); +void mail_storage_set_index_error(struct mail_storage *storage, + struct mail_index *index); bool mail_storage_set_error_from_errno(struct mail_storage *storage); void mail_storage_copy_list_error(struct mail_storage *storage, struct mailbox_list *list); diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index b205a36b67..32a350264b 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -602,16 +602,23 @@ void mail_storage_copy_list_error(struct mail_storage *storage, void mailbox_set_index_error(struct mailbox *box) { - if (mail_index_is_deleted(box->index)) + if (mail_index_is_deleted(box->index)) { mailbox_set_deleted(box); - else { - mail_storage_set_internal_error(box->storage); - /* use the lib-index's error as our internal error string */ - box->storage->last_internal_error = - i_strdup(mail_index_get_error_message(box->index)); - box->storage->last_error_is_internal = TRUE; + mail_index_reset_error(box->index); + } else { + mail_storage_set_index_error(box->storage, box->index); } - mail_index_reset_error(box->index); +} + +void mail_storage_set_index_error(struct mail_storage *storage, + struct mail_index *index) +{ + mail_storage_set_internal_error(storage); + /* use the lib-index's error as our internal error string */ + storage->last_internal_error = + i_strdup(mail_index_get_error_message(index)); + storage->last_error_is_internal = TRUE; + mail_index_reset_error(index); } const struct mail_storage_settings *