block: Don't use error_abort in blk_new_open

We have an errp and bdrv_root_attach_child can fail permission check,
error_abort is not the best choice here.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Fam Zheng 2017-03-07 19:07:21 +08:00 committed by Kevin Wolf
parent d282f34e82
commit 50bfbe93b2
1 changed files with 6 additions and 1 deletions

View File

@ -213,7 +213,12 @@ BlockBackend *blk_new_open(const char *filename, const char *reference,
}
blk->root = bdrv_root_attach_child(bs, "root", &child_root,
perm, BLK_PERM_ALL, blk, &error_abort);
perm, BLK_PERM_ALL, blk, errp);
if (!blk->root) {
bdrv_unref(bs);
blk_unref(blk);
return NULL;
}
return blk;
}