]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lazy-expunge: If MAIL_FETCH_REFCOUNT fails because mail is expunged, ignore the error.
authorTimo Sirainen <tss@iki.fi>
Mon, 17 Aug 2015 16:31:42 +0000 (19:31 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 17 Aug 2015 16:31:42 +0000 (19:31 +0300)
src/plugins/lazy-expunge/lazy-expunge-plugin.c

index fbb872ddfa9c9efbc4add41b818e3ef412f02130..4ab6e99122708413a8583102c052c5c1e2465b89 100644 (file)
@@ -150,13 +150,19 @@ static int lazy_expunge_mail_is_last_instace(struct mail *_mail)
 {
        struct lazy_expunge_transaction *lt =
                LAZY_EXPUNGE_CONTEXT(_mail->transaction);
-       const char *value;
+       const char *value, *errstr;
        unsigned long refcount;
+       enum mail_error error;
 
        if (mail_get_special(_mail, MAIL_FETCH_REFCOUNT, &value) < 0) {
+               errstr = mailbox_get_last_error(_mail->box, &error);
+               if (error == MAIL_ERROR_EXPUNGED) {
+                       /* already expunged - just ignore it */
+                       return 0;
+               }
                mail_storage_set_critical(_mail->box->storage,
                        "lazy_expunge: Couldn't lookup message's refcount: %s",
-                       mailbox_get_last_error(_mail->box, NULL));
+                       errstr);
                return -1;
        }
        if (*value == '\0') {