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 jes.soren...@redhat.com: >>> 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