[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/3] qemu-img: fix img_commit() error return val
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 1/3] qemu-img: fix img_commit() error return value |
Date: |
Tue, 26 Aug 2014 13:31:10 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 |
On 08/26/2014 12:17 PM, Stefan Hajnoczi wrote:
> The img_commit() return value is a process exit code. Use 1 for failure
> instead of -1. The other failure paths in this function already use 1.
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> qemu-img.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/qemu-img.c b/qemu-img.c
> index c843420..dc3adb5 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -771,7 +771,7 @@ static int img_commit(int argc, char **argv)
> ret = bdrv_parse_cache_flags(cache, &flags);
> if (ret < 0) {
> error_report("Invalid cache option: %s", cache);
> - return -1;
> + return 1;
Nothing against this patch (you're consistent with the surrounding code,
and most of qemu for that matter), but it highlights why I'm a fan of
'return EXIT_FAILURE' instead of 'return 1' in functions that return an
exit status, because that makes it a lot more obvious _why_ I'm
returning a non-negative number to represent failure.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 0/3] qemu-img: error path fixes, Stefan Hajnoczi, 2014/08/26
- [Qemu-devel] [PATCH 2/3] qemu-img: fix img_compare() flags error path, Stefan Hajnoczi, 2014/08/26
- [Qemu-devel] [PATCH 3/3] qemu-img: always goto out in img_snapshot() error paths, Stefan Hajnoczi, 2014/08/26
- Re: [Qemu-devel] [PATCH 0/3] qemu-img: error path fixes, John Snow, 2014/08/26
- Re: [Qemu-devel] [PATCH 0/3] qemu-img: error path fixes, Stefan Hajnoczi, 2014/08/27