Skip to content

Commit

Permalink
quota: Fixed handling when mail size lookup fails due to mail already…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
sirainen authored and GitLab committed Aug 11, 2016
1 parent cf1b9b6 commit d6b6061
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/plugins/quota/quota.c
Expand Up @@ -1111,9 +1111,16 @@ int quota_try_alloc(struct quota_transaction_context *ctx,
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;
}

Expand Down

0 comments on commit d6b6061

Please sign in to comment.