From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUkTj-0006zC-Db for qemu-devel@nongnu.org; Thu, 18 Sep 2014 18:47:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUkTe-0006fG-FO for qemu-devel@nongnu.org; Thu, 18 Sep 2014 18:47:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUkTe-0006ew-8G for qemu-devel@nongnu.org; Thu, 18 Sep 2014 18:47:02 -0400 Message-ID: <541B60DF.7020208@redhat.com> Date: Thu, 18 Sep 2014 16:46:55 -0600 From: Eric Blake MIME-Version: 1.0 References: <1411079940-26553-1-git-send-email-drjones@redhat.com> In-Reply-To: <1411079940-26553-1-git-send-email-drjones@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NNOwfpW8WIumgAqBbkWocCcQtRvVr88qH" Subject: Re: [Qemu-devel] [PATCH] ivshmem: use error_report List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrew Jones , qemu-devel@nongnu.org Cc: afaerber@suse.de, mst@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --NNOwfpW8WIumgAqBbkWocCcQtRvVr88qH Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/18/2014 04:39 PM, Andrew Jones wrote: > Replace all the fprintf(stderr, ...) calls with error_report. >=20 > Signed-off-by: Andrew Jones > --- > hw/misc/ivshmem.c | 27 +++++++++++++-------------- > 1 file changed, 13 insertions(+), 14 deletions(-) >=20 > diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c > index bf585b7691998..d285df7d65a9f 100644 > --- a/hw/misc/ivshmem.c > +++ b/hw/misc/ivshmem.c > @@ -300,7 +300,7 @@ static CharDriverState* create_eventfd_chr_device(v= oid * opaque, EventNotifier * > chr =3D qemu_chr_open_eventfd(eventfd); > =20 > if (chr =3D=3D NULL) { > - fprintf(stderr, "creating eventfd for eventfd %d failed\n", ev= entfd); > + error_report("creating eventfd for eventfd %d failed\n", event= fd); The conversion to error_report() should also drop trailing \n. > exit(-1); Another bug (but probably worth cleaning up in a separate patch) - exit(-1) is the same as exit(255), which is not a usual exit status (although it DOES make xargs behave differently). > /* BARs must be a power of 2 */ > if (!is_power_of_two(value)) { > - fprintf(stderr, "ivshmem: size must be power of 2\n"); > + error_report("size must be power of 2\n"); > exit(1); But seeing as how much of this file uses the more typical exit(1), we should consistently use 1 in all places where we exit early. > } else if ((fd =3D shm_open(s->shmobj, O_CREAT|O_RDWR, > S_IRWXU|S_IRWXG|S_IRWXO)) < 0) { > - fprintf(stderr, "ivshmem: could not open shared file\n"); > + error_report("could not open shared file\n"); > exit(-1); Another weird use of exit(-1). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --NNOwfpW8WIumgAqBbkWocCcQtRvVr88qH 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 iQEcBAEBCAAGBQJUG2DfAAoJEKeha0olJ0NqEHoH/3NsoEXxjCDNyHGZOikvkaNg hOT4STmEXgzInxoL+/u3QcNJ2wOnD4Elot5U4VDejq8CoSQ56M9uhF1L/gqYpaWU BjoGJeTmUg5T1jAWtG/rsHLV0VkbWRFSCbb+7VcXp+nSUjSz/kK+BIztAaosIkaM PjeEbnQQTYn84HGvxlDDOdZ+1Kz3rtI9i+Jot+L6+JVCiOl/r/LgTJnPI2RZGat2 8J37pBy2X/aIIilGG4zSG2DNFOqns3POZ+aQUi1uYxv+/JtOi0hMOAgaN6rvuN9x SazatcKThJkKFWrBwOqao1Rd0DtEWi4SiMd83cekDUuw7mJWleenUDbUjDgas20= =aZT6 -----END PGP SIGNATURE----- --NNOwfpW8WIumgAqBbkWocCcQtRvVr88qH--