From: Kevin Wolf <kwolf@suse.de>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] qemu-img: Fix type of getopt return value
Date: Wed, 14 Jan 2009 09:55:11 +0100 [thread overview]
Message-ID: <496DA86F.40400@suse.de> (raw)
In-Reply-To: <496CE528.5090509@codemonkey.ws>
[-- Attachment #1: Type: text/plain, Size: 726 bytes --]
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
[-- Attachment #2: qemu-img-fix-type.patch --]
[-- Type: text/x-patch, Size: 733 bytes --]
>From 6fd77e3094a6bdd94e353ac7380cac70f5490024 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@suse.de>
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 <kwolf@suse.de>
---
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
next prev parent reply other threads:[~2009-01-14 8:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-07 17:40 [Qemu-devel] [6215] snapshot subcommand for qemu-img (Kevin Wolf) Anthony Liguori
2009-01-13 19:02 ` Anthony Liguori
2009-01-13 20:36 ` M. Warner Losh
2009-01-14 8:55 ` Kevin Wolf [this message]
2009-01-15 21:42 ` [Qemu-devel] Re: [PATCH] qemu-img: Fix type of getopt return value Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=496DA86F.40400@suse.de \
--to=kwolf@suse.de \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).