changeset 21675:82913199b864

lazy-expunge: Fix error handling for GUID lookups 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.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 22 Feb 2017 15:32:19 +0200
parents 785620a45fc5
children 8ecc25852f37
files src/plugins/lazy-expunge/lazy-expunge-plugin.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Wed Feb 22 16:09:07 2017 +0200
+++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Wed Feb 22 15:32:19 2017 +0200
@@ -207,8 +207,13 @@
 		   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') {