From: Timo Sirainen Date: Sat, 18 Nov 2017 21:14:25 +0000 (+0200) Subject: lib-storage: Fix mailbox_create_missing_dir() with storages that have no mail root dir X-Git-Tag: 2.3.0.rc1~425 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eaebd98a29299a4bde843323bc2edbde1d0d7d45;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Fix mailbox_create_missing_dir() with storages that have no mail root dir The mailbox still exists even if the mail root directory doesn't, so there's no point in even trying to stat() it. --- diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index 880a16814b..ff0de66e21 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -2770,7 +2770,8 @@ int mailbox_create_missing_dir(struct mailbox *box, if (stat(dir, &st) == 0) return 0; - if (null_strcmp(dir, mail_dir) != 0 && mail_dir != NULL && + if ((box->storage->class_flags & MAIL_STORAGE_CLASS_FLAG_NO_ROOT) == 0 && + null_strcmp(dir, mail_dir) != 0 && mail_dir != NULL && stat(mail_dir, &st) < 0 && (errno == ENOENT || errno == ENOTDIR)) { /* Race condition - mail root directory doesn't exist anymore either. We shouldn't create this directory