summaryrefslogtreecommitdiffstats
path: root/block/cow.c
diff options
context:
space:
mode:
authorPaolo Bonzini2014-02-17 14:44:06 +0100
committerKevin Wolf2014-02-21 21:02:24 +0100
commit76abe4071d111a9ca6dcc9b9689a831c39ffa718 (patch)
treefc844ff36395e5b133a7d1b7f60fe7a56bb85d61 /block/cow.c
parentvmdk: correctly propagate errors (diff)
downloadqemu-76abe4071d111a9ca6dcc9b9689a831c39ffa718.tar.gz
qemu-76abe4071d111a9ca6dcc9b9689a831c39ffa718.tar.xz
qemu-76abe4071d111a9ca6dcc9b9689a831c39ffa718.zip
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 <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/cow.c')
-rw-r--r--block/cow.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/cow.c b/block/cow.c
index 9e4f624b01..30deb88deb 100644
--- a/block/cow.c
+++ b/block/cow.c
@@ -74,7 +74,8 @@ static int cow_open(BlockDriverState *bs, QDict *options, int flags,
}
if (be32_to_cpu(cow_header.magic) != COW_MAGIC) {
- ret = -EMEDIUMTYPE;
+ error_setg(errp, "Image not in COW format");
+ ret = -EINVAL;
goto fail;
}