]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lazy-expunge: Fix error handling for GUID lookups
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 22 Feb 2017 13:32:19 +0000 (15:32 +0200)
committerGitLab <gitlab@git.dovecot.net>
Wed, 22 Feb 2017 17:48:04 +0000 (19:48 +0200)
If the mail is already expunged, the error should be ignored.
In other situations the original error string should be preserved as
part of the logged error message.

src/plugins/lazy-expunge/lazy-expunge-plugin.c

index 17b03186aa0ede55a41f022b53926c304d1aee5b..3c10d5366b88ea9a6a88bd55aaa97cac7950c954 100644 (file)
@@ -207,8 +207,13 @@ static int lazy_expunge_mail_is_last_instace(struct mail *_mail)
                   see the same refcount, so we need to adjust the refcount
                   by tracking the expunged message GUIDs. */
                if (mail_get_special(_mail, MAIL_FETCH_GUID, &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 GUID");
+                               "lazy_expunge: Couldn't lookup message's GUID: %s", errstr);
                        return -1;
                }
                if (*value == '\0') {