While vmdk_open_desc_file (touched by the patch) correctly changed -1 to -EINVAL, vmdk_open did not. Fix it directly in vmdk_parent_open.
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- block/vmdk.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index 5d16ec4..21566eb 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -286,7 +286,7 @@ static int vmdk_parent_open(BlockDriverState *bs) desc[DESC_SIZE] = '\0'; if (bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE) != DESC_SIZE) { - return -1; + return -EINVAL; } p_name = strstr(desc, "parentFileNameHint"); @@ -296,10 +296,10 @@ static int vmdk_parent_open(BlockDriverState *bs) p_name += sizeof("parentFileNameHint") + 1; end_name = strchr(p_name, '\"'); if (end_name == NULL) { - return -1; + return -EINVAL; } if ((end_name - p_name) > sizeof(bs->backing_file) - 1) { - return -1; + return -EINVAL; } pstrcpy(bs->backing_file, end_name - p_name + 1, p_name); @@ -629,9 +629,10 @@ static int vmdk_open_desc_file(BlockDriverState *bs, int flags, } /* try to open parent images, if exist */ - if (vmdk_parent_open(bs)) { + ret = vmdk_parent_open(bs); + if (ret) { vmdk_free_extents(bs); - return -EINVAL; + return ret; } s->parent_cid = vmdk_read_cid(bs, 1); return 0; -- 1.7.6