# HG changeset patch # User Timo Sirainen # Date 1513107367 -7200 # Node ID d5b44ec763b0f326b960c59e6d52c38e2ce41877 # Parent 12c7ddbeae9265e60c430b3e14fa52691247977d lib-storage: Make sure index root is created when it's the same as root directory Fixes errors about failing to create mailboxes.lock when the index root directory doesn't exist yet. diff -r 12c7ddbeae92 -r d5b44ec763b0 src/lib-storage/mailbox-list.c --- a/src/lib-storage/mailbox-list.c Thu Apr 26 09:48:39 2018 +0300 +++ b/src/lib-storage/mailbox-list.c Tue Dec 12 21:36:07 2017 +0200 @@ -1653,27 +1653,23 @@ int mailbox_list_mkdir_missing_index_root(struct mailbox_list *list) { - const char *root_dir, *index_dir; + const char *index_dir; int ret; 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. */ ret = mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_INDEX, &index_dir); if (ret <= 0) return ret; - ret = mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_MAILBOX, - &root_dir); - if (ret <= 0) - return ret; - 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; }