From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeVyp-0004F5-K1 for qemu-devel@nongnu.org; Thu, 07 Nov 2013 15:15:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VeVyk-0003XF-KU for qemu-devel@nongnu.org; Thu, 07 Nov 2013 15:15:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:61995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeVyk-0003X6-Ao for qemu-devel@nongnu.org; Thu, 07 Nov 2013 15:14:58 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rA7KEua5026112 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 7 Nov 2013 15:14:57 -0500 Message-ID: <527BF4BF.80105@redhat.com> Date: Thu, 07 Nov 2013 13:14:55 -0700 From: Eric Blake MIME-Version: 1.0 References: <1383851429-9213-1-git-send-email-mreitz@redhat.com> In-Reply-To: <1383851429-9213-1-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GxIubGIDk8u32v4hb1CVKfFQxkK3JdVHd" Subject: Re: [Qemu-devel] [PATCH] util/error: Save errno from clobbering List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GxIubGIDk8u32v4hb1CVKfFQxkK3JdVHd Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 11/07/2013 12:10 PM, Max Reitz wrote: > There may be calls to error_setg() and especially error_setg_errno() > which blindly (and until now wrongly) assume these functions not to > clobber errno (e.g., they pass errno to error_setg_errno() and return > -errno afterwards). Instead of trying to find and fix all of these > constructs, just make sure error_setg() and error_setg_errno() indeed d= o > not clobber errno. >=20 > Suggested-by: Eric Blake > Signed-off-by: Max Reitz > --- > util/error.c | 6 ++++++ > 1 file changed, 6 insertions(+) Reviewed-by: Eric Blake I did a quick glance through 'git grep -p -A2 error_set' for any more culprits beyond the one you just fixed in block.c, and didn't spot any obvious ones; but there were enough 'goto error' statements where I didn't check if the code at the error label was depending on sane errno value; and it is definitely easier for code maintenance if you don't have to think about whether logging an error will clobber the error. (Not to mention I've also patched libvirt to have the same paradigm of logging functions guaranteeing no modification to errno). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --GxIubGIDk8u32v4hb1CVKfFQxkK3JdVHd 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.15 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSe/S/AAoJEKeha0olJ0NqfikIAItjFAHAKT68SMfsCuiu36V9 CI5h2V8ipqs5eMGjQgwS1gQXp2c8+D4l5VkPD9jKqu+pwo8rZj7sv2qS46dw/0V5 WpnA30W3jWNJ3aIIrtxP0gmPuzqY/h3vJK1OJu9wTMcR/HRbPkJ+GM5b8WtNU+fe Uu2KMPQ39a1dxx/WD+h2tDNwnDnqJ5oHgnmpCyD43jZJr/FuqaOWF7mmthC6X3zX YwL/1XW4DKuDrQN9X8GaIdx/hbHkHUK8akEqYHSTwmK+G/6WCLDer9jJfFO1LkKr qyEFU5r7lt22KxsJ43EQBD7rDKB35SVSTs/NvVi6sI2cwluu/Bo45kP8eCvh8Xk= =JAdQ -----END PGP SIGNATURE----- --GxIubGIDk8u32v4hb1CVKfFQxkK3JdVHd--