From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkaUF-0002sc-Bb for qemu-devel@nongnu.org; Sat, 01 Nov 2014 11:21:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XkaU1-0006LP-Ey for qemu-devel@nongnu.org; Sat, 01 Nov 2014 11:21:07 -0400 Received: from resqmta-po-10v.sys.comcast.net ([96.114.154.169]:53639) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkaU1-0006L9-A1 for qemu-devel@nongnu.org; Sat, 01 Nov 2014 11:20:53 -0400 Message-ID: <5454F9C7.4020208@redhat.com> Date: Sat, 01 Nov 2014 09:18:31 -0600 From: Eric Blake MIME-Version: 1.0 References: <1414806603-22556-1-git-send-email-zhang.zhanghailiang@huawei.com> <1414806603-22556-4-git-send-email-zhang.zhanghailiang@huawei.com> In-Reply-To: <1414806603-22556-4-git-send-email-zhang.zhanghailiang@huawei.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ra4XqvpVjvsr9UuoFxXED5jfIhKlWTRbX" Subject: Re: [Qemu-devel] [PATCH 3/4] qemu-char: convert some open functions to use Error API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang , qemu-trivial@nongnu.org Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, peter.huangpeng@huawei.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ra4XqvpVjvsr9UuoFxXED5jfIhKlWTRbX Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/31/2014 07:50 PM, zhanghailiang wrote: > Convert several Character backend open functions to use the Error API. >=20 > Signed-off-by: zhanghailiang > --- > qemu-char.c | 52 +++++++++++++++++++++++++++------------------------- > 1 file changed, 27 insertions(+), 25 deletions(-) > @@ -2337,12 +2339,12 @@ static CharDriverState *qemu_chr_open_stdio(Cha= rdevStdio *opts) > if (stdio->hInputThread =3D=3D INVALID_HANDLE_VALUE > || stdio->hInputReadyEvent =3D=3D INVALID_HANDLE_VALUE > || stdio->hInputDoneEvent =3D=3D INVALID_HANDLE_VALUE) { > - fprintf(stderr, "cannot create stdio thread or event\n"); > + error_setg(errp, "cannot create stdio thread or event"); > exit(1); This conversion feels wrong. error_setg() does not report an error, it just stores the error for a later entity higher in the call stack to report it. But exit() means there is no execution of the reporting code. Either leave this one alone, or get rid of the exit and instead properly propagate error status back to the caller and make sure the caller reports it. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --ra4XqvpVjvsr9UuoFxXED5jfIhKlWTRbX 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 iQEcBAEBCAAGBQJUVPnHAAoJEKeha0olJ0NqVxwIAIYAvMbkXqMt99ieNPRWN8xK hUxZk+0EI/5A25c75CyYnxKxoOUKCeUvvtN8pXAnzztFyDMm4NlRAqwKQwnAmbL8 uj7FxI7fAdO4mepWMauCobXKS1A98VmrDTaesaTdEp8SEollHLmvqt5qcliiDo9t dk5fmye4hCnF4vOqwpHuEbUvYX/W8/2fludylS9lyUkOuIEII1jOmwovhJ3Dh+Ik 5BOAEMhena+VEtuHn8hFo4bSag8SxkmtHg1WPgjgE/KDiAzpdHnOCgeyVAqib4ZY 7wUTVIdpO7Af8Mu/goeMlNmHwZ1gPNqGN9dpVtKM/OCU48VHT3ioFm2r9DFIjBU= =+MeW -----END PGP SIGNATURE----- --ra4XqvpVjvsr9UuoFxXED5jfIhKlWTRbX--