From patchwork Mon Nov 5 07:41:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v4] correct error message qemu-img reported From: liguang X-Patchwork-Id: 197157 Message-Id: <1352101300-12060-1-git-send-email-lig.fnst@cn.fujitsu.com> To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, liguang Date: Mon, 5 Nov 2012 15:41:40 +0800 qemu-img will complain when qcow or qcow2 size overflow for 64 bits, report the right message in this condition. Signed-off-by: liguang Reviewed-by: Stefan Hajnoczi Nacked-by: QEMU Patches --- qemu-img.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index b41e670..d9434ad 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -340,7 +340,12 @@ static int img_create(int argc, char **argv) int64_t sval; char *end; sval = strtosz_suffix(argv[optind++], &end, STRTOSZ_DEFSUFFIX_B); - if (sval < 0 || *end) { + if (sval < 0) { + error_report("Image size must be less than 8 exabytes!"); + ret = -1; + goto out; + } + if (*end) { error_report("Invalid image size specified! You may use k, M, G or " "T suffixes for "); error_report("kilobytes, megabytes, gigabytes and terabytes.");