From: Timo Sirainen Date: Mon, 17 Aug 2015 16:31:42 +0000 (+0300) Subject: lazy-expunge: If MAIL_FETCH_REFCOUNT fails because mail is expunged, ignore the error. X-Git-Tag: 2.2.19.rc1~247 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=42562240cadb78223a6463755711141532353538;p=thirdparty%2Fdovecot%2Fcore.git lazy-expunge: If MAIL_FETCH_REFCOUNT fails because mail is expunged, ignore the error. --- diff --git a/src/plugins/lazy-expunge/lazy-expunge-plugin.c b/src/plugins/lazy-expunge/lazy-expunge-plugin.c index fbb872ddfa..4ab6e99122 100644 --- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c +++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c @@ -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') {