From 588a47cd86f0bed43f0a6253217ee031ce372eb0 Mon Sep 17 00:00:00 2001 From: Josef 'Jeff' Sipek Date: Mon, 17 Oct 2016 09:13:21 -0400 Subject: [PATCH] lib-storage: treat empty root_dir as an empty string --- src/lib-storage/mail-storage-private.h | 2 ++ src/lib-storage/mail-storage.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib-storage/mail-storage-private.h b/src/lib-storage/mail-storage-private.h index ee6f49f774..e5fc1bea81 100644 --- a/src/lib-storage/mail-storage-private.h +++ b/src/lib-storage/mail-storage-private.h @@ -117,6 +117,8 @@ struct mail_storage { int obj_refcount; /* Linked list of all mailboxes in the storage */ struct mailbox *mailboxes; + /* A "root dir" to enable storage sharing. It is only ever used for + * uniqueness checking (via strcmp) and never used as a path. */ const char *unique_root_dir; char *error_string; diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index 2fac3775cc..c145e281e5 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -282,7 +282,7 @@ mail_storage_match_class(struct mail_storage *storage, return FALSE; if ((storage->class_flags & MAIL_STORAGE_CLASS_FLAG_UNIQUE_ROOT) != 0 && - strcmp(storage->unique_root_dir, set->root_dir) != 0) + strcmp(storage->unique_root_dir, set->root_dir ? set->root_dir : "") != 0) return FALSE; if (strcmp(storage->name, "shared") == 0) { -- 2.47.3