From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS60Z-0000fW-49 for qemu-devel@nongnu.org; Tue, 26 Jul 2016 13:19:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bS60U-0007Ht-T4 for qemu-devel@nongnu.org; Tue, 26 Jul 2016 13:19:06 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:6325 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS60U-0007Hf-Nc for qemu-devel@nongnu.org; Tue, 26 Jul 2016 13:19:02 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u6QHEkjB011589 for ; Tue, 26 Jul 2016 13:19:02 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 24e4eddy6y-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 26 Jul 2016 13:19:02 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 26 Jul 2016 18:19:00 +0100 References: <1468845016-43468-1-git-send-email-pasic@linux.vnet.ibm.com> <1469532873-78542-1-git-send-email-pasic@linux.vnet.ibm.com> <7c4bdb1e-f0aa-4a07-2780-37f4f92c6665@redhat.com> From: Halil Pasic Date: Tue, 26 Jul 2016 19:18:27 +0200 MIME-Version: 1.0 In-Reply-To: <7c4bdb1e-f0aa-4a07-2780-37f4f92c6665@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OBfUVeFvDeI4hIOl5AL3ePKOHdGvPD9k8" Message-Id: <57979B63.1060505@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH v2 1/1] block: improve error handling in raw_open List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-block@nongnu.org Cc: Kevin Wolf , Cornelia Huck , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --OBfUVeFvDeI4hIOl5AL3ePKOHdGvPD9k8 From: Halil Pasic To: Max Reitz , qemu-block@nongnu.org Cc: Kevin Wolf , Cornelia Huck , qemu-devel@nongnu.org Message-ID: <57979B63.1060505@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH v2 1/1] block: improve error handling in raw_open References: <1468845016-43468-1-git-send-email-pasic@linux.vnet.ibm.com> <1469532873-78542-1-git-send-email-pasic@linux.vnet.ibm.com> <7c4bdb1e-f0aa-4a07-2780-37f4f92c6665@redhat.com> In-Reply-To: <7c4bdb1e-f0aa-4a07-2780-37f4f92c6665@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 07/26/2016 05:42 PM, Max Reitz wrote: >> +++ b/block/raw-posix.c >> > @@ -485,6 +485,7 @@ static int raw_open_common(BlockDriverState *bs,= QDict *options, >> > s->fd =3D -1; >> > fd =3D qemu_open(filename, s->open_flags, 0644); >> > if (fd < 0) { >> > + error_setg_errno(errp, errno, "Could not open file"); > We don't guarantee that error_setg_errno() does not modify errno. (In > practice it should not, but we don't guarantee that.) >=20 Thank you very much for your review. I have double checked, and I remembered correctly: error_setg_errno saves and restores the original errno, so that is why I assumed it does not.=20 > Therefore, the common pattern is to save the errno value before calling= > this function, i.e. to put the function call... >=20 >> > ret =3D -errno; > ...here. >=20 > With that fixed, the patch should be good. >=20 > Max >=20 =20 But now that you have this pointed out, I understand, it is better to have no function calls between failure and saving the errno. I will post a v3 and keep this in mind for the future. Sorry for the extra work. Frankly, I'm a bit uncomfortable with asking (do not want to be pushy), but do you have an opinion on the 'error_report_err' issue (pointed out in the cover letter part)? Cheers, Halil --OBfUVeFvDeI4hIOl5AL3ePKOHdGvPD9k8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iQIcBAEBAgAGBQJXl5uBAAoJEA0vhuyXGx0AWEIP/iRAfQJERCc9LbFu4kMUOgIA pgOZvi+bqO8j6B+QRTEnHkjuOwAizhyCwX9T9+13VMXs7fqaDr03ySphzYoCezNr KRJBRI7KHzVFmXlmNBZWjEsT0gDfJP8vGipppJs5sokIUUSi9jnfjj7+Y3Q5J6ur YhVGm0AUujtaLNuiQ1/s7mUUzHZvwMtAthuX366E5W0IuOoW2S8XDK8c1zp5kEfL dzc/hWbKO3jAEW55eo/k4k8j3oXJTJndn0ApE4m9kPkWhXAlUYn8xUs1Iweq2oNr b+eoVdfQH3faoB3oZXJLpBio98zEJq8IvpzJQETXcDeLT9MHOi4K0DHcyuLysRRf uG/fhZ+gjF79VCQmw7DV3Ywic6tEXxFH9DdfiPvIKzm535xggqaavANfrn3gGIFf tvTH++VI5+T1gHx/bVUQBKfkfZeEYthrw477a5OGpGy46UM/HWw+DhE7drW1vXRd OyQUhMwT83gOvMOjb4lUbgfgmb5qjpZmHebkn0h/lwaMmIsNCZyJWeyj4mzANDZJ yHmYz9joJD2XbuBe3duWd6y2A+GKstLpQUyw3T+UYNmz9Liea4zqRexEyNbWgnQp ho0L2GbYNWjMd6sp+lOYusNPmNlN5RD2ud6+WELADVOYiaetvBEcUbYT65tG2f7J MU6x02l7UEkYoFDW6yNq =2UJD -----END PGP SIGNATURE----- --OBfUVeFvDeI4hIOl5AL3ePKOHdGvPD9k8--