changeset 20627:464988cb3980

quota: Fixed handling when mail size lookup fails due to mail already being expunged. We don't want to fail it as a quota allocation failure, but just pass through the "mail is expunged" error to the original caller.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 10 Aug 2016 19:13:09 +0300
parents 9df9bdd84ab1
children c5438de8fc7f
files src/plugins/quota/quota.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/quota/quota.c	Wed Aug 10 17:56:14 2016 +0300
+++ b/src/plugins/quota/quota.c	Wed Aug 10 19:13:09 2016 +0300
@@ -1110,9 +1110,16 @@
 		return 1;
 
 	if (mail_get_physical_size(mail, &size) < 0) {
+		enum mail_error error;
+		const char *errstr = mailbox_get_last_error(mail->box, &error);
+
+		if (error == MAIL_ERROR_EXPUNGED) {
+			/* mail being copied was already expunged. it'll fail,
+			   so just return success for the quota allocated. */
+			return 1;
+		}
 		i_error("quota: Failed to get mail size (box=%s, uid=%u): %s",
-			mail->box->vname, mail->uid,
-			mailbox_get_last_error(mail->box, NULL));
+			mail->box->vname, mail->uid, errstr);
 		return -1;
 	}