From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVCQB-0003Kz-ET for qemu-devel@nongnu.org; Wed, 24 Apr 2013 23:00:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVCQ8-0008W9-BN for qemu-devel@nongnu.org; Wed, 24 Apr 2013 23:00:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11190) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVCQ8-0008W0-0S for qemu-devel@nongnu.org; Wed, 24 Apr 2013 23:00:28 -0400 Message-ID: <51789C33.1050809@redhat.com> Date: Wed, 24 Apr 2013 21:00:03 -0600 From: Eric Blake MIME-Version: 1.0 References: <51780BD3.6000004@redhat.com> <51789A9D.80905@linux.vnet.ibm.com> In-Reply-To: <51789A9D.80905@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2INVIBFOIKMRIJCWCSTPT" Subject: Re: [Qemu-devel] [PATCH v2 01/12] qemu-img: introduce qemu_img_handle_error() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: kwolf@redhat.com, armbru@redhat.com, Pavel Hrdina , qemu-devel@nongnu.org, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2INVIBFOIKMRIJCWCSTPT Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 04/24/2013 08:53 PM, Wenchao Xia wrote: >>> >>> +static int qemu_img_handle_error(Error *err) >>> +{ >>> + if (error_is_set(&err)) { >>> + error_report("%s", error_get_pretty(err)); >>> + error_free(err); >>> + return 1; >>> + } >>> + return 0; >> >> Maybe it's just me, but I think returning EXIT_SUCCESS/EXIT_FAILURE >> instead of 0/1 is a bit nicer at expressing why we chose a positive >> value; but that would be a separate cleanup to all of qemu-img.c. >> Hence, I have no problems giving: >> >> Reviewed-by: Eric Blake >> > Maybe an incode comments like: > +/* Returns 1 on error. */ That would also help. My main concern was that +1 on error is unusual compared to most of qemu that returns <0 on error. The _reason_ it is a positive number is because we are really returning EXIT_FAILURE (a well-defined constant from system headers) - but calling the number by its name is smarter than just using a magic number without explanation. But as I already said, that's a bigger problem for a different series. >=20 > Reviewed-by: Wenchao Xia >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2INVIBFOIKMRIJCWCSTPT 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.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJReJwzAAoJEKeha0olJ0Nqja8IAJGrvagaRWK8rc0J/nvGvX49 fMvDqxtyjtEQUOF0My+PgffDR6G71jNPnA4MsfJe00imRmj8N15ZyMrux39k5on5 pLQ+SsWzGJxWZVEpeBOZkkjZ8eG5HzM3SszSSUMmNy3Pin4L5LljXaiClTIPofW0 WWXaqG8PxroJL1Rh1a3gLDNsUPWzQ+cGgNQ7W027S4+VelDdWiirXtj8CvOx5z4R W3i5Li/jLpWxiIiIRGWscwcaUVMLYWEqkzFGvSoY7g0plix8vOSkIr2xMNRPBzez mdrejT0zEBi+Nu8b4x6dRdAxZsuRtsohWMX+nPfBpoxYEtD+u3Zn8jonfJ4kVJU= =w0zO -----END PGP SIGNATURE----- ------enig2INVIBFOIKMRIJCWCSTPT--