From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULKlX-0002gp-Iw for qemu-devel@nongnu.org; Thu, 28 Mar 2013 17:53:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULKlW-0003Q6-Ak for qemu-devel@nongnu.org; Thu, 28 Mar 2013 17:53:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60315) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULKlW-0003Pu-1X for qemu-devel@nongnu.org; Thu, 28 Mar 2013 17:53:46 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2SLrjJO017897 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Mar 2013 17:53:45 -0400 Message-ID: <5154BBE8.2080504@redhat.com> Date: Thu, 28 Mar 2013 15:53:44 -0600 From: Eric Blake MIME-Version: 1.0 References: In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2TRCSLAQGLALCIEHHDFIE" Subject: Re: [Qemu-devel] [PATCH v3 09/11] block: update return value from bdrv_snapshot_create List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Hrdina Cc: lcapitulino@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2TRCSLAQGLALCIEHHDFIE Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/28/2013 10:47 AM, Pavel Hrdina wrote: > If we provide error message we don't have to also provide return > value because we could check if there is any error message or not. >=20 > Signed-off-by: Pavel Hrdina > --- > block.c | 24 ++++++++++-------------- > block/qcow2-snapshot.c | 12 +++++------- > block/qcow2.h | 6 +++--- > block/rbd.c | 15 ++++++--------- > block/sheepdog.c | 9 ++++----- > include/block/block.h | 6 +++--- > include/block/block_int.h | 6 +++--- > qemu-img.c | 9 ++++----- > savevm.c | 4 ++-- > 9 files changed, 40 insertions(+), 51 deletions(-) >=20 > @@ -2018,11 +2019,9 @@ static int img_snapshot(int argc, char **argv) > sn.date_sec =3D tv.tv_sec; > sn.date_nsec =3D tv.tv_usec * 1000; > =20 > - ret =3D bdrv_snapshot_create(bs, &sn, NULL); > - if (ret) { > - error_report("Could not create snapshot '%s': %d (%s)", > - snapshot_name, ret, strerror(-ret)); > - } > + local_err =3D NULL; > + bdrv_snapshot_create(bs, &sn, &local_err); > + ret =3D qemu_img_handle_error(local_err); This sets ret=3D=3D1 on error, but bdrv_snapshot_create used to return <0= on error. Then again, the tail of img_snapshot() normalizes all errors to a 'return 1'. Took me a few minutes to see, but no problem after all. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2TRCSLAQGLALCIEHHDFIE 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/ iQEcBAEBCAAGBQJRVLvoAAoJEKeha0olJ0NqSMwIAK86lOtktpbRJd4f2CfqcxHS cWr/7zEUm4PJIub18pFGA93cVUHP8Tx6M7xACHaXBqCRV5Hx7hneT58fSiRjmIbL s6EaMAysp07oL9QFvc1gMUpUwIJ8d5rzLszQj5CdgUN9tvn+UayJ9/TLa0Bt4Aab LUw4qw90ufPBFdWhCVdiggjQVp4SXLgc82DrXw1QI8BMRz5lKOAfwAu47vwhvmZv 33bO3ixfaNQEzzDgHXcoFDgI8MLFz7siaecnAlWOMouQ8OphmcUYYAqHsL0dxHX2 kUCDfWOJv1FffdXtlhPOsrSL2yoiNXXyEIyk6XnbDj2S+Fe65Ya0T7PdSmI5a3A= =Yk8s -----END PGP SIGNATURE----- ------enig2TRCSLAQGLALCIEHHDFIE--