From 76abe4071d111a9ca6dcc9b9689a831c39ffa718 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 17 Feb 2014 14:44:06 +0100 Subject: block: do not abuse EMEDIUMTYPE Returning "Wrong medium type" for an image that does not have a valid header is a bit weird. Improve the error by mentioning what format was trying to open it. Signed-off-by: Paolo Bonzini Reviewed-by: Fam Zheng Signed-off-by: Kevin Wolf --- block/vdi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'block/vdi.c') diff --git a/block/vdi.c b/block/vdi.c index 2d7490f173..f3c6acf3cf 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -395,8 +395,8 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, } if (header.signature != VDI_SIGNATURE) { - logout("bad vdi signature %08x\n", header.signature); - ret = -EMEDIUMTYPE; + error_setg(errp, "Image not in VDI format (bad signature %08x)", header.signature); + ret = -EINVAL; goto fail; } else if (header.version != VDI_VERSION_1_1) { logout("unsupported version %u.%u\n", -- cgit v1.2.3