From: Timo Sirainen Date: Wed, 27 Jun 2012 09:12:52 +0000 (+0300) Subject: lib-storage: Fixed handling failures when autocreating mailboxes. X-Git-Tag: 2.1.8~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b28fc85b1d7261e06d8b725dabd4c0328f9eafbc;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Fixed handling failures when autocreating mailboxes. --- diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index e3a471377c..0bc75df5de 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -819,17 +819,18 @@ static int mailbox_check_mismatching_separators(struct mailbox *box) return 0; } -static void mailbox_autocreate(struct mailbox *box) +static int mailbox_autocreate(struct mailbox *box) { const char *errstr; enum mail_error error; if (mailbox_create(box, NULL, FALSE) < 0) { errstr = mailbox_get_last_error(box, &error); - if (error != MAIL_ERROR_NOTFOUND && !box->inbox_user) { + if (error != MAIL_ERROR_NOTFOUND) { mail_storage_set_critical(box->storage, "Failed to autocreate mailbox %s: %s", box->vname, errstr); + return -1; } } else if (box->set != NULL && strcmp(box->set->autocreate, @@ -838,15 +839,18 @@ static void mailbox_autocreate(struct mailbox *box) mail_storage_set_critical(box->storage, "Failed to autosubscribe to mailbox %s: %s", box->vname, mailbox_get_last_error(box, NULL)); + return -1; } } + return 0; } static int mailbox_autocreate_and_reopen(struct mailbox *box) { int ret; - mailbox_autocreate(box); + if (mailbox_autocreate(box) < 0) + return -1; mailbox_close(box); ret = box->v.open(box);