From: Timo Sirainen Date: Thu, 6 Jul 2017 14:45:02 +0000 (+0300) Subject: lib-storage: Set mailbox list index to be refreshed after changes, not before X-Git-Tag: 2.2.32.rc1~115 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=263ffaea0777304fdffe04a04beaee54b8694bc8;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Set mailbox list index to be refreshed after changes, not before Mailbox deletion and rename set the refresh-flag before the change was done. This was unnecessary if the change didn't happen. Also there was a race condition that another process could have done the refresh before the change was even done. --- diff --git a/src/lib-storage/list/mailbox-list-index.c b/src/lib-storage/list/mailbox-list-index.c index f1e851f151..ac1168e86a 100644 --- a/src/lib-storage/list/mailbox-list-index.c +++ b/src/lib-storage/list/mailbox-list-index.c @@ -668,8 +668,10 @@ mailbox_list_index_delete_mailbox(struct mailbox_list *list, const char *name) { struct mailbox_list_index *ilist = INDEX_LIST_CONTEXT(list); + if (ilist->module_ctx.super.delete_mailbox(list, name) < 0) + return -1; mailbox_list_index_refresh_later(list); - return ilist->module_ctx.super.delete_mailbox(list, name); + return 0; } static int @@ -677,8 +679,10 @@ mailbox_list_index_delete_dir(struct mailbox_list *list, const char *name) { struct mailbox_list_index *ilist = INDEX_LIST_CONTEXT(list); + if (ilist->module_ctx.super.delete_dir(list, name) < 0) + return -1; mailbox_list_index_refresh_later(list); - return ilist->module_ctx.super.delete_dir(list, name); + return 0; } static int @@ -689,11 +693,14 @@ mailbox_list_index_rename_mailbox(struct mailbox_list *oldlist, { struct mailbox_list_index *oldilist = INDEX_LIST_CONTEXT(oldlist); + if (oldilist->module_ctx.super.rename_mailbox(oldlist, oldname, + newlist, newname) < 0) + return -1; + mailbox_list_index_refresh_later(oldlist); if (oldlist != newlist) mailbox_list_index_refresh_later(newlist); - return oldilist->module_ctx.super. - rename_mailbox(oldlist, oldname, newlist, newname); + return 0; } static int