summaryrefslogtreecommitdiff
path: root/block/qcow.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2014-02-17 14:43:58 +0100
committerKevin Wolf <kwolf@redhat.com>2014-02-21 21:02:23 +0100
commitb6d5066d32f9e6c3d7508c1af9ae78327a927120 (patch)
treec20a945cb392a77a7e8b73e3c6045263da148c02 /block/qcow.c
parent2a94fee3f649bdd2d71c78bb56977284f096f842 (diff)
downloadqemu-b6d5066d32f9e6c3d7508c1af9ae78327a927120.tar.gz
qemu-b6d5066d32f9e6c3d7508c1af9ae78327a927120.tar.bz2
qemu-b6d5066d32f9e6c3d7508c1af9ae78327a927120.zip
qcow: correctly propagate errors
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/qcow.c')
-rw-r--r--block/qcow.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/block/qcow.c b/block/qcow.c
index 8d00853ab5..ef8920bf07 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -119,17 +119,19 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
if (header.version != QCOW_VERSION) {
char version[64];
snprintf(version, sizeof(version), "QCOW version %d", header.version);
- qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
- bs->device_name, "qcow", version);
+ error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
+ bs->device_name, "qcow", version);
ret = -ENOTSUP;
goto fail;
}
if (header.size <= 1 || header.cluster_bits < 9) {
+ error_setg(errp, "invalid value in qcow header");
ret = -EINVAL;
goto fail;
}
if (header.crypt_method > QCOW_CRYPT_AES) {
+ error_setg(errp, "invalid encryption method in qcow header");
ret = -EINVAL;
goto fail;
}
@@ -686,8 +688,7 @@ static int qcow_create(const char *filename, QEMUOptionParameter *options,
ret = bdrv_create_file(filename, options, &local_err);
if (ret < 0) {
- qerror_report_err(local_err);
- error_free(local_err);
+ error_propagate(errp, local_err);
return ret;
}
@@ -695,8 +696,7 @@ static int qcow_create(const char *filename, QEMUOptionParameter *options,
ret = bdrv_open(&qcow_bs, filename, NULL, NULL,
BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err);
if (ret < 0) {
- qerror_report_err(local_err);
- error_free(local_err);
+ error_propagate(errp, local_err);
return ret;
}