static int mbox_mailbox_create(struct mailbox *box, const struct mailbox_update *update, bool directory) { int fd, ret; if ((ret = index_storage_mailbox_create(box, directory)) <= 0) return ret; if (box->inbox_any) { if (create_inbox(box) < 0) return -1; } else { /* create the mbox file */ ret = mailbox_create_fd(box, mailbox_get_path(box), O_RDWR | O_CREAT | O_EXCL, &fd); if (ret < 0) return -1; if (ret == 0) { mail_storage_set_error(box->storage, MAIL_ERROR_EXISTS, "Mailbox already exists"); return -1; } i_close_fd(&fd); } return update == NULL ? 0 : mbox_mailbox_update(box, update); }
static int mbox_mailbox_create(struct mailbox *box, const struct mailbox_update *update, bool directory) { int fd, ret; if (directory && (box->list->props & MAILBOX_LIST_PROP_NO_NOSELECT) == 0) return 0; if (box->inbox_any) { if (create_inbox(box) < 0) return -1; } else { /* create the mbox file */ ret = mailbox_create_fd(box, box->path, O_RDWR | O_CREAT | O_EXCL, &fd); if (ret < 0) return -1; if (ret == 0) { mail_storage_set_error(box->storage, MAIL_ERROR_EXISTS, "Mailbox already exists"); return -1; } (void)close(fd); } return update == NULL ? 0 : mbox_mailbox_update(box, update); }