[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] qemu-img: Fix type of getopt return value
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH] qemu-img: Fix type of getopt return value |
Date: |
Wed, 14 Jan 2009 09:55:11 +0100 |
User-agent: |
Thunderbird 2.0.0.17 (X11/20080922) |
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
>From 6fd77e3094a6bdd94e353ac7380cac70f5490024 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <address@hidden>
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 <address@hidden>
---
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