]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Make sure index root is created when it's the same as root directory
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 12 Dec 2017 19:36:07 +0000 (21:36 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 13 Dec 2017 16:30:35 +0000 (18:30 +0200)
This is required by the following commit.

src/lib-storage/mailbox-list.c

index b921fdadb5d1af754ed0bce373fc3823a0b57b44..997704fb1d26625aa64a94aa11392e9a208385d4 100644 (file)
@@ -1659,24 +1659,21 @@ static bool mailbox_list_init_changelog(struct mailbox_list *list)
 
 int mailbox_list_mkdir_missing_index_root(struct mailbox_list *list)
 {
-       const char *root_dir, *index_dir;
+       const char *index_dir;
 
        if (list->index_root_dir_created)
                return 1;
 
-       /* if index root dir hasn't been created yet, do it now */
+       /* If index root dir hasn't been created yet, do it now.
+          Do this here even if the index directory is the same as mail root
+          directory, because it may not have been created elsewhere either. */
        if (!mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_INDEX,
                                        &index_dir))
                return 0;
-       if (!mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_MAILBOX,
-                                       &root_dir))
-               return 0;
 
-       if (strcmp(root_dir, index_dir) != 0) {
-               if (mailbox_list_mkdir_root(list, index_dir,
-                                           MAILBOX_LIST_PATH_TYPE_INDEX) < 0)
-                       return -1;
-       }
+       if (mailbox_list_mkdir_root(list, index_dir,
+                                   MAILBOX_LIST_PATH_TYPE_INDEX) < 0)
+               return -1;
        list->index_root_dir_created = TRUE;
        return 1;
 }