changeset 21163:a3cb1f46a9ab

lib-storage: treat empty root_dir as an empty string
author Josef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
date Mon, 17 Oct 2016 09:13:21 -0400
parents af0e68ec2857
children 78ec76a97aa4
files src/lib-storage/mail-storage-private.h src/lib-storage/mail-storage.c
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/mail-storage-private.h	Fri Nov 18 14:10:02 2016 +0200
+++ b/src/lib-storage/mail-storage-private.h	Mon Oct 17 09:13:21 2016 -0400
@@ -117,6 +117,8 @@
 	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;
--- a/src/lib-storage/mail-storage.c	Fri Nov 18 14:10:02 2016 +0200
+++ b/src/lib-storage/mail-storage.c	Mon Oct 17 09:13:21 2016 -0400
@@ -282,7 +282,7 @@
 		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) {