From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LN1RP-0003Wm-Qb for qemu-devel@nongnu.org; Wed, 14 Jan 2009 03:49:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LN1RO-0003Vn-0D for qemu-devel@nongnu.org; Wed, 14 Jan 2009 03:49:35 -0500 Received: from [199.232.76.173] (port=34803 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LN1RN-0003Vi-SD for qemu-devel@nongnu.org; Wed, 14 Jan 2009 03:49:33 -0500 Received: from mx2.suse.de ([195.135.220.15]:35729) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LN1RN-0003Q7-E6 for qemu-devel@nongnu.org; Wed, 14 Jan 2009 03:49:33 -0500 Message-ID: <496DA86F.40400@suse.de> Date: Wed, 14 Jan 2009 09:55:11 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <496CE528.5090509@codemonkey.ws> In-Reply-To: <496CE528.5090509@codemonkey.ws> Content-Type: multipart/mixed; boundary="------------020408030704020406030007" Subject: [Qemu-devel] [PATCH] qemu-img: Fix type of getopt return value Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------020408030704020406030007 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Anthony Liguori schrieb: > Anthony Liguori wrote: >> +static void img_snapshot(int argc, char **argv) >> +{ >> + BlockDriverState *bs; >> + QEMUSnapshotInfo sn; >> + char *filename, *snapshot_name = NULL; >> + char c; >> + int ret; >> + int action = 0; >> + qemu_timeval tv; >> + >> + /* Parse commandline parameters */ >> + for(;;) { >> + c = getopt(argc, argv, "la:c:d:h"); >> + if (c == -1) >> + break; >> > > char's are not always signed so this code is incorrect. You should use > an int instead. Can you send another patch fixing this please? You're right. I better should have copied not only the parsing but also the declarations... Patch is attached. Kevin --------------020408030704020406030007 Content-Type: text/x-patch; name="qemu-img-fix-type.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu-img-fix-type.patch" >>From 6fd77e3094a6bdd94e353ac7380cac70f5490024 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Wed, 14 Jan 2009 09:39:33 +0100 Subject: [PATCH] qemu-img: Fix type of getopt return value getopt doesn't return a char but an int. Signed-off-by: Kevin Wolf --- qemu-img.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 964b28b..ed61d3a 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -751,8 +751,7 @@ static void img_snapshot(int argc, char **argv) BlockDriverState *bs; QEMUSnapshotInfo sn; char *filename, *snapshot_name = NULL; - char c; - int ret; + int c, ret; int action = 0; qemu_timeval tv; -- 1.6.0.2 --------------020408030704020406030007--