]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fix mailbox_create_missing_dir() with storages that have no mail root dir
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 18 Nov 2017 21:14:25 +0000 (23:14 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 20 Nov 2017 12:30:00 +0000 (14:30 +0200)
The mailbox still exists even if the mail root directory doesn't, so there's
no point in even trying to stat() it.

src/lib-storage/mail-storage.c

index 880a16814b7e7facf48dd2208ba2330bbd5489cb..ff0de66e2134353124b38dba9a75bde2e4a6ea95 100644 (file)
@@ -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