Am 02.12.2010 18:46, schrieb jes.soren...@redhat.com: > From: Jes Sorensen <jes.soren...@redhat.com> > > This patch changes qemu-img to exit if an unknown option is detected, > instead of trying to continue with a set of arguments which may be > incorrect. > > Signed-off-by: Jes Sorensen <jes.soren...@redhat.com> > --- > qemu-img.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 48 insertions(+), 0 deletions(-) > > 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? Kevin