]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Add mail_storage_set_index_error()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 21 Aug 2017 12:34:40 +0000 (15:34 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 12 Sep 2017 09:29:06 +0000 (12:29 +0300)
src/lib-storage/mail-storage-private.h
src/lib-storage/mail-storage.c

index 25e5c672d46d1d815045f23973f7c2c6334af1e6..f230041ecf361d6d281cc6abc9bec64d6f61fd59 100644 (file)
@@ -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);
index b205a36b6781287947b4390bab8d5b532cc0258c..32a350264b5df76b719e40f49274a364b2e48186 100644 (file)
@@ -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 *