From d7086422b1c1e75e320519cfe26176db6ec97a37 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Fri, 13 Jan 2017 19:02:32 +0100 Subject: block: Add error parameter to blk_insert_bs() Now that blk_insert_bs() requests the BlockBackend permissions for the node it attaches to, it can fail. Instead of aborting, pass the errors to the callers. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Acked-by: Fam Zheng --- block.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'block.c') diff --git a/block.c b/block.c index 41b8b11..5f2dd6f 100644 --- a/block.c +++ b/block.c @@ -2194,8 +2194,11 @@ static BlockDriverState *bdrv_open_inherit(const char *filename, } if (file_bs != NULL) { file = blk_new(BLK_PERM_CONSISTENT_READ, BLK_PERM_ALL); - blk_insert_bs(file, file_bs); + blk_insert_bs(file, file_bs, &local_err); bdrv_unref(file_bs); + if (local_err) { + goto fail; + } qdict_put(options, "file", qstring_from_str(bdrv_get_node_name(file_bs))); -- cgit v1.1