There is no good system error for this kind of error, so it needs special handling instead of strerror.
Signed-off-by: Stefan Weil <s...@weilnetz.de> --- blockdev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index 5a4cd56..3da44f6 100644 --- a/blockdev.c +++ b/blockdev.c @@ -624,8 +624,13 @@ DriveInfo *drive_init(QemuOpts *opts, BlockInterfaceType block_default_type) ret = bdrv_open(dinfo->bdrv, file, bdrv_flags, drv); if (ret < 0) { - error_report("could not open disk image %s: %s", - file, strerror(-ret)); + if (ret == BDRV_WRONG_FORMAT) { + error_report("could not open disk image %s: not in %s format", + file, drv->format_name); + } else { + error_report("could not open disk image %s: %s", + file, strerror(-ret)); + } goto err; } -- 1.7.10.4