# HG changeset patch # User Timo Sirainen # Date 1498820214 -10800 # Node ID f01b39a6d3b494fafa543a75377be7babe15cc9d # Parent 471c8c88c5d12895ea5f02fc7d350f8e0ac9643f lib-storage: Fix mailbox delete to not delete childrens' INDEX or CONTROL dirs If mail_location had separate INDEX and/or CONTROL set, deleting a mailbox with children caused the childrens' index and/or control directories to be deleted (but the mail/ALT directories weren't). I'm not sure why the _FLAG_MAILBOX_FILES was treated as a special case earlier. It shouldn't make a difference. diff -r 471c8c88c5d1 -r f01b39a6d3b4 src/lib-storage/list/mailbox-list-delete.c --- a/src/lib-storage/list/mailbox-list-delete.c Tue Jun 27 15:39:12 2017 +0300 +++ b/src/lib-storage/list/mailbox-list-delete.c Fri Jun 30 13:56:54 2017 +0300 @@ -295,8 +295,10 @@ strcmp(path, mailbox_path) == 0) return 0; - if (*list->set.maildir_name == '\0' && - (list->flags & MAILBOX_LIST_FLAG_MAILBOX_FILES) == 0) { + /* Note that only ALT currently uses maildir_name in paths. + INDEX and CONTROL don't. */ + if (type != MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX || + *list->set.maildir_name == '\0') { /* this directory may contain also child mailboxes' data. we don't want to delete that. */ bool rmdir_path = *list->set.maildir_name != '\0';