[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 3/3] Fail if detecting an unknown option
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] Re: [PATCH 3/3] Fail if detecting an unknown option |
Date: |
Mon, 06 Dec 2010 10:37:05 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Thunderbird/3.0.10 |
Am 06.12.2010 09:02, schrieb Jes Sorensen:
> On 12/03/10 13:30, Kevin Wolf wrote:
>> Am 02.12.2010 18:46, schrieb address@hidden:
>>> diff --git a/qemu-img.c b/qemu-img.c
>>> index d0dc445..f2e1c94 100644
>>> --- a/qemu-img.c
>>> +++ b/qemu-img.c
>>> @@ -304,6 +304,12 @@ static int img_create(int argc, char **argv)
>>> flags = 0;
>>> for(;;) {
>>> c = getopt(argc, argv, "F:b:f:he6o:");
>>> + /*
>>> + * Fail if we detect an unknown argument
>>> + */
>>> + if (c == '?') {
>>> + return 1;
>>> + }
>>> if (c == -1) {
>>> break;
>>> }
>>
>> Why not making it another case in the switch statement below instead of
>> an additional if?
>
> There is a perfectly logical explanation for that. Doing that would
> require for me to have clue, which is a bit much to expect :)
>
> That said, we should really do the same for the c == -1 case as well.
That's what I thought at first, too. But then the break relates to the
switch instead of the for, so it would have to become a goto to a new
label. Probably not a big improvement...
Kevin
- Re: [Qemu-devel] [PATCH 1/3] Consolidate printing of block driver options, (continued)