From: Timo Sirainen Date: Thu, 25 Mar 2021 13:36:49 +0000 (+0200) Subject: lib-storage: Sync mailbox if autoexpunging finds mails that are already expunged X-Git-Tag: 2.3.16~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fa92b1a362cfaf1d37e610f7a21483f349c5a097;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Sync mailbox if autoexpunging finds mails that are already expunged The syncing should remove the mails from the index. --- diff --git a/src/lib-storage/mail-autoexpunge.c b/src/lib-storage/mail-autoexpunge.c index f00008d895..f7c4b5ab0d 100644 --- a/src/lib-storage/mail-autoexpunge.c +++ b/src/lib-storage/mail-autoexpunge.c @@ -59,7 +59,7 @@ mailbox_autoexpunge_batch(struct mailbox *box, const void *data; size_t size; unsigned int count = 0; - bool done = FALSE; + bool done = FALSE, expunges_found = FALSE; int ret = 0; mail_index_get_header_ext(box->view, box->box_last_rename_stamp_ext_id, @@ -100,6 +100,7 @@ mailbox_autoexpunge_batch(struct mailbox *box, count++; } else if (mailbox_get_last_mail_error(box) == MAIL_ERROR_EXPUNGED) { /* already expunged */ + expunges_found = TRUE; } else { /* failed */ ret = -1; @@ -109,7 +110,7 @@ mailbox_autoexpunge_batch(struct mailbox *box, mail_free(&mail); if (mailbox_transaction_commit(&t) < 0) ret = -1; - else if (count > 0) { + else if (count > 0 || expunges_found) { if (mailbox_sync(box, 0) < 0) ret = -1; *expunged_count += count;