From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMMSc-0000Cu-3C for qemu-devel@nongnu.org; Tue, 26 Aug 2014 15:31:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMMSX-0006Hg-4r for qemu-devel@nongnu.org; Tue, 26 Aug 2014 15:31:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMMSW-0006Ha-TR for qemu-devel@nongnu.org; Tue, 26 Aug 2014 15:31:13 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7QJVBtN029648 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 26 Aug 2014 15:31:11 -0400 Message-ID: <53FCE07E.8020308@redhat.com> Date: Tue, 26 Aug 2014 13:31:10 -0600 From: Eric Blake MIME-Version: 1.0 References: <1409077076-29855-1-git-send-email-stefanha@redhat.com> <1409077076-29855-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1409077076-29855-2-git-send-email-stefanha@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="C6XIheFAQLjShrXqcmlENENW0dLPBuaDg" Subject: Re: [Qemu-devel] [PATCH 1/3] qemu-img: fix img_commit() error return value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Kevin Wolf , Jeff Cody , jsnow@redhat.com, Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --C6XIheFAQLjShrXqcmlENENW0dLPBuaDg Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 08/26/2014 12:17 PM, Stefan Hajnoczi wrote: > The img_commit() return value is a process exit code. Use 1 for failur= e > instead of -1. The other failure paths in this function already use 1.= >=20 > Signed-off-by: Stefan Hajnoczi > --- > qemu-img.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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 =3D 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --C6XIheFAQLjShrXqcmlENENW0dLPBuaDg Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJT/OB+AAoJEKeha0olJ0NqE0QH/it0CQ3tFtgrXX0h/b9u6ExV cAylzJd4mCAxMWZl58/fznP6Ha/+ZGesz98MdVupSNZON81eOKiw/Kgg0fxClG+S Ys2JL47QMYK3FMB9SfhkSGujqQxQlqvWuZTy4Myb7lK1x17kIkyRKkxXIIxuoWvG ccA8q32180XD6lRHVO1+61P1kC34+8NSo1rEqTBAtQVDec5woFFy/j8qIC1ApqZY Rs+05Xhrh6WxJsfJyNjEl7+qBrUuKjjUP+RBaQYt4FGQO1Xjhh1yDjQGKEDmUf3J fpIeRelyYB5Ierq2Fr2lu3WhKHnnsQYqxO5Zs04V4gh+H9YMh5qrCp4MKssstjU= =eeVr -----END PGP SIGNATURE----- --C6XIheFAQLjShrXqcmlENENW0dLPBuaDg--