qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qemu-img: Exit with code 0 if there is no error


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] qemu-img: Exit with code 0 if there is no error
Date: Fri, 18 Apr 2014 08:29:36 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

On 04/18/2014 12:23 AM, Fam Zheng wrote:
> Signed-off-by: Fam Zheng <address@hidden>
> ---
>  qemu-img.c | 68 
> +++++++++++++++++++++++++++++++-------------------------------
>  1 file changed, 34 insertions(+), 34 deletions(-)
> 

>  /* Please keep in synch with qemu-img.texi */
> -static void help(void)
> +static void help(bool error)

This doesn't intuitively tell me whether 'true' is success (0 status) or
failure (non-zero status).

>  {
>      const char *help_msg =
>             "qemu-img version " QEMU_VERSION ", Copyright (c) 2004-2008 
> Fabrice Bellard\n"
> @@ -129,7 +129,7 @@ static void help(void)
>      printf("%s\nSupported formats:", help_msg);
>      bdrv_iterate_format(format_print, NULL);
>      printf("\n");
> -    exit(1);
> +    exit(error ? 1 : 0);

Oh - true for failure.  I'd MUCH rather see:

static void help(int status)
...
    exit(status)

and all callers use:

help(EXIT_SUCCESS)

or

help(EXIT_FAILURE)

as appropriate.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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