dovecot-2.1: lib-storage: Fixed handling failures when autocreat...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 27 12:13:02 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/0e41d7c48a8b
changeset: 14579:0e41d7c48a8b
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 27 12:12:52 2012 +0300
description:
lib-storage: Fixed handling failures when autocreating mailboxes.

diffstat:

 src/lib-storage/mail-storage.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (44 lines):

diff -r 20703dbd1168 -r 0e41d7c48a8b src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Mon Jun 25 19:40:24 2012 +0300
+++ b/src/lib-storage/mail-storage.c	Wed Jun 27 12:12:52 2012 +0300
@@ -819,17 +819,18 @@
 	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 @@
 			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);


More information about the dovecot-cvs mailing list