]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Sync mailbox if autoexpunging finds mails that are already expunged
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 25 Mar 2021 13:36:49 +0000 (15:36 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Mon, 14 Jun 2021 21:06:36 +0000 (21:06 +0000)
The syncing should remove the mails from the index.

src/lib-storage/mail-autoexpunge.c

index f00008d89596ca9023f1e1a2e58f595ccd010957..f7c4b5ab0daef3f912ed2fee6505ead165376de0 100644 (file)
@@ -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;