From b2f9b1d4f89c7c241ac12e526b3331f3a371677e Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 1 Jul 2016 11:12:03 +0300 Subject: [PATCH] lib-storage: Autoexpunging should ignore nonexistent mailboxes. The check was done too late after recent changes. --- src/lib-storage/mail-autoexpunge.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib-storage/mail-autoexpunge.c b/src/lib-storage/mail-autoexpunge.c index a9d0054043..9956f866b6 100644 --- a/src/lib-storage/mail-autoexpunge.c +++ b/src/lib-storage/mail-autoexpunge.c @@ -28,8 +28,13 @@ mailbox_autoexpunge(struct mailbox *box, unsigned int interval_time, /* first try to check quickly from mailbox list index if we should bother opening this mailbox. */ - if (mailbox_get_status(box, STATUS_MESSAGES, &status) < 0) + if (mailbox_get_status(box, STATUS_MESSAGES, &status) < 0) { + if (mailbox_get_last_mail_error(box) == MAIL_ERROR_NOTFOUND) { + /* autocreated mailbox doesn't exist yet */ + return 0; + } return -1; + } if (interval_time == 0 && status.messages <= max_mails) return 0; @@ -42,13 +47,8 @@ mailbox_autoexpunge(struct mailbox *box, unsigned int interval_time, return 0; } - if (mailbox_sync(box, MAILBOX_SYNC_FLAG_FAST) < 0) { - if (mailbox_get_last_mail_error(box) == MAIL_ERROR_NOTFOUND) { - /* autocreated mailbox doesn't exist yet */ - return 0; - } + if (mailbox_sync(box, MAILBOX_SYNC_FLAG_FAST) < 0) return -1; - } t = mailbox_transaction_begin(box, 0); mail = mail_alloc(t, 0, NULL); -- 2.47.2