Skip to content

Commit

Permalink
lazy-expunge: Handle mailbox create race conditions.
Browse files Browse the repository at this point in the history
Don't log an error if another process just created the lazy-expunge mailbox.
  • Loading branch information
sirainen committed May 11, 2016
1 parent 5b98064 commit c42662d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/plugins/lazy-expunge/lazy-expunge-plugin.c
Expand Up @@ -125,13 +125,19 @@ mailbox_open_or_create(struct mailbox_list *list, struct mailbox *src_box,
}

/* try creating and re-opening it. */
if (mailbox_create(box, NULL, FALSE) < 0 ||
mailbox_open(box) < 0) {
if (mailbox_create(box, NULL, FALSE) < 0 &&
mailbox_get_last_mail_error(box) != MAIL_ERROR_EXISTS) {
*error_r = t_strdup_printf("Failed to create mailbox %s: %s", name,
mailbox_get_last_error(box, NULL));
mailbox_free(&box);
return NULL;
}
if (mailbox_open(box) < 0) {
*error_r = t_strdup_printf("Failed to open created mailbox %s: %s", name,
mailbox_get_last_error(box, NULL));
mailbox_free(&box);
return NULL;
}
return box;
}

Expand Down

0 comments on commit c42662d

Please sign in to comment.