qemu-devel
[Top][All Lists]
Advanced

[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: Fri, 03 Dec 2010 13:30:28 +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 02.12.2010 18:46, schrieb address@hidden:
> From: Jes Sorensen <address@hidden>
> 
> 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 <address@hidden>
> ---
>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]