Skip to content

Commit

Permalink
virtual: Avoid assert-crash if backend mailbox's have_guid lookup fails
Browse files Browse the repository at this point in the history
The MAIL_ERROR_NOTFOUND can happen if the mailbox was already deleted.
Other errors aren't expected to happen and possibly point to a bug.

Fixes:
Panic: file mail-storage.c: line 1831: unreached
  • Loading branch information
sirainen authored and GitLab committed Jul 6, 2017
1 parent 8f75c29 commit d528259
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/plugins/virtual/virtual-storage.c
Expand Up @@ -554,8 +554,23 @@ static int virtual_storage_set_have_guid_flags(struct virtual_mailbox *mbox)
bboxes = array_get(&mbox->backend_boxes, &count);
for (i = 0; i < count; i++) {
if (mailbox_get_status(bboxes[i]->box, 0, &status) < 0) {
virtual_box_copy_error(&mbox->box, bboxes[i]->box);
return -1;
const char *errstr;
enum mail_error error;

errstr = mailbox_get_last_error(bboxes[i]->box, &error);
if (error == MAIL_ERROR_NOTFOUND) {
/* backend mailbox was just lost - skip it */
continue;
}
/* Not expected to happen, but we can't return failure
since this could be called from
mailbox_get_open_status() and it would panic.
So just log the error and skip the mailbox. */
mail_storage_set_critical(mbox->box.storage,
"Virtual mailbox %s: Failed to get have_guid existence for backend mailbox %s: %s",
mailbox_get_vname(&mbox->box),
mailbox_get_vname(bboxes[i]->box), errstr);
continue;
}
if (!status.have_guids)
mbox->have_guids = FALSE;
Expand Down

0 comments on commit d528259

Please sign in to comment.