On Sun, 02/09 10:48, Paolo Bonzini wrote:
> diff --git a/block/bochs.c b/block/bochs.c
> index 51d9a90..f0f9a7e 100644
> --- a/block/bochs.c
> +++ b/block/bochs.c
> @@ -129,7 +129,8 @@ static int bochs_open(BlockDriverState *bs, QDict
> *options, int flags,
> strcmp(bochs.subtype, GROWING_TYPE) ||
> ((le32_to_cpu(bochs.version) != HEADER_VERSION) &&
> (le32_to_cpu(bochs.version) != HEADER_V1))) {
> - return -EMEDIUMTYPE;
> + error_setg(errp, "invalid Bochs image header\n");
Ending "\n" is not necessary, including all following cases.
> + return -EINVAL;
> }
>
> if (le32_to_cpu(bochs.version) == HEADER_V1) {
<snip>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 2da62b8..fa63d37 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -449,7 +449,7 @@ static int qcow2_open(BlockDriverState *bs, QDict
> *options, int flags,
>
> if (header.magic != QCOW_MAGIC) {
> error_setg(errp, "Image is not in qcow2 format");
It might be good to have a consistent message pattern in qcow2 as others. Is it
worth adding a QERR_ error class for unexpected format magic?
Fam
> - ret = -EMEDIUMTYPE;
> + ret = -EINVAL;
> goto fail;
> }
> if (header.version < 2 || header.version > 3) {