@@ -5364,7 +5364,7 @@ static int img_measure(int argc, char **argv)
QemuOpts *sn_opts = NULL;
QemuOptsList *create_opts = NULL;
bool image_opts = false;
- uint64_t img_size = UINT64_MAX;
+ int64_t img_size = -1;
BlockMeasureInfo *info = NULL;
Error *local_err = NULL;
int ret = 1;
@@ -5422,16 +5422,11 @@ static int img_measure(int argc, char **argv)
}
break;
case OPTION_SIZE:
- {
- int64_t sval;
-
- sval = cvtnum("image size", optarg);
- if (sval < 0) {
+ img_size = cvtnum("image size", optarg);
+ if (img_size < 0) {
goto out;
}
- img_size = (uint64_t)sval;
- }
- break;
+ break;
}
}
@@ -5446,11 +5441,11 @@ static int img_measure(int argc, char **argv)
error_report("--image-opts, -f, and -l require a filename argument.");
goto out;
}
- if (filename && img_size != UINT64_MAX) {
+ if (filename && img_size != -1) {
error_report("--size N cannot be used together with a filename.");
goto out;
}
- if (!filename && img_size == UINT64_MAX) {
+ if (!filename && img_size == -1) {
error_report("Either --size N or one filename must be specified.");
goto out;
}
@@ -5498,7 +5493,7 @@ static int img_measure(int argc, char **argv)
goto out;
}
}
- if (img_size != UINT64_MAX) {
+ if (img_size != -1) {
qemu_opt_set_number(opts, BLOCK_OPT_SIZE, img_size, &error_abort);
}