Received: from eggs.gnu.org ([208.118.235.92]:53907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU7gu-0004oO-UQ for qemu-devel@nongnu.org; Thu, 01 Nov 2012 23:13:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TU7gt-0001qS-JG for qemu-devel@nongnu.org; Thu, 01 Nov 2012 23:13:04 -0400 Received: from csmailer.cs.nctu.edu.tw ([140.113.235.130]:19566) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU7gt-0001pi-2C for qemu-devel@nongnu.org; Thu, 01 Nov 2012 23:13:03 -0400 Date: Fri, 2 Nov 2012 11:12:54 +0800 From: =?utf-8?B?6Zmz6Z+L5Lu7IChXZWktUmVuIENoZW4p?= Message-ID: <20121102031254.GA30520@cs.nctu.edu.tw> References: <1351823750-30515-1-git-send-email-lig.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1351823750-30515-1-git-send-email-lig.fnst@cn.fujitsu.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] correct error message qemu-img reported List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liguang Cc: qemu-devel@nongnu.org On Fri, Nov 02, 2012 at 10:35:50AM +0800, liguang wrote: > qemu-img will complain when qcow or qcow2 > size overflow for 64 bits, report the right > message in this condition. >=20 > Signed-off-by: liguang > --- > qemu-img.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/qemu-img.c b/qemu-img.c > index f17f187..a332467 100644 > --- a/qemu-img.c > +++ b/qemu-img.c > @@ -343,10 +343,12 @@ static int img_create(int argc, char **argv) > =20 > /* Get image size, if specified */ > if (optind < argc) { > - int64_t sval; > + int64_t sval =3D 0; > char *end; > sval =3D strtosz_suffix(argv[optind++], &end, STRTOSZ_DEFSUFFI= X_B); > - if (sval < 0 || *end) { > + if (sval < 0) > + error_report("image size is too large!\n"); ^^^ wrong ident? > + if (*end) { > error_report("Invalid image size specified! You may use k,= M, G or " > "T suffixes for "); > error_report("kilobytes, megabytes, gigabytes and terabyte= s."); > --=20 > 1.7.1 >=20 --=20 Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj