]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fix error message when mailbox list index rebuild fails
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 27 Oct 2020 13:13:39 +0000 (15:13 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 10 Nov 2020 15:24:01 +0000 (17:24 +0200)
The error needs to be copied to mailbox_list, otherwise it's just
"Unknown internal list error".

src/lib-storage/list/mailbox-list-index.c

index 36132877b977ee1bb42b650b46081329d61ad7dc..a588fb00803022bd9bf32fcf76c50f5fa3e4fc67 100644 (file)
@@ -604,16 +604,21 @@ list_handle_corruption_locked(struct mailbox_list *list,
                              enum mail_storage_list_index_rebuild_reason reason)
 {
        struct mail_storage *const *storagep;
+       const char *errstr;
+       enum mail_error error;
 
        array_foreach(&list->ns->all_storages, storagep) {
-               if ((*storagep)->v.list_index_rebuild != NULL) {
-                       if ((*storagep)->v.list_index_rebuild(*storagep, reason) < 0)
-                               return -1;
-                       else {
-                               /* FIXME: implement a generic handler that
-                                  just lists mailbox directories in filesystem
-                                  and adds the missing ones to the index. */
-                       }
+               if ((*storagep)->v.list_index_rebuild == NULL)
+                       continue;
+
+               if ((*storagep)->v.list_index_rebuild(*storagep, reason) < 0) {
+                       errstr = mail_storage_get_last_internal_error(*storagep, &error);
+                       mailbox_list_set_error(list, error, errstr);
+                       return -1;
+               } else {
+                       /* FIXME: implement a generic handler that
+                          just lists mailbox directories in filesystem
+                          and adds the missing ones to the index. */
                }
        }
        return mailbox_list_index_set_uncorrupted(list);