aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 09e7e72f5a..731502c2ce 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -687,16 +687,23 @@ static int img_check(int argc, char **argv)
check->corruptions_fixed = corruptions_fixed;
}
- switch (output_format) {
- case OFORMAT_HUMAN:
- dump_human_image_check(check, quiet);
- break;
- case OFORMAT_JSON:
- dump_json_image_check(check, quiet);
- break;
+ if (!ret) {
+ switch (output_format) {
+ case OFORMAT_HUMAN:
+ dump_human_image_check(check, quiet);
+ break;
+ case OFORMAT_JSON:
+ dump_json_image_check(check, quiet);
+ break;
+ }
}
if (ret || check->check_errors) {
+ if (ret) {
+ error_report("Check failed: %s", strerror(-ret));
+ } else {
+ error_report("Check failed");
+ }
ret = 1;
goto fail;
}