[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qemu-img: show help for invalid global options
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] qemu-img: show help for invalid global options |
Date: |
Mon, 13 Mar 2017 08:17:17 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 03/13/2017 12:11 AM, Stefan Hajnoczi wrote:
> The qemu-img sub-command executes regardless of invalid global options:
>
> $ qemu-img --foo info test.img
> qemu-img: unrecognized option '--foo'
> image: test.img
> ...
>
> The unrecognized option warning may be missed by the user. This can
> hide incorrect command-lines in scripts and confuse users.
>
> This patch prints the help information and terminates instead of
> executing the sub-command.
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> qemu-img.c | 1 +
> 1 file changed, 1 insertion(+)
Reviewed-by: Eric Blake <address@hidden>
>
> diff --git a/qemu-img.c b/qemu-img.c
> index 98b836b..ce293a4 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -4339,6 +4339,7 @@ int main(int argc, char **argv)
> while ((c = getopt_long(argc, argv, "+hVT:", long_options, NULL)) != -1)
> {
> switch (c) {
> case 'h':
> + case '?':
> help();
> return 0;
> case 'V':
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature