From: Eric Blake <eblake@redhat.com>
To: zhanghailiang <zhang.zhanghailiang@huawei.com>, qemu-trivial@nongnu.org
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, peter.huangpeng@huawei.com
Subject: Re: [Qemu-devel] [PATCH 3/4] qemu-char: convert some open functions to use Error API
Date: Sat, 01 Nov 2014 09:18:31 -0600 [thread overview]
Message-ID: <5454F9C7.4020208@redhat.com> (raw)
In-Reply-To: <1414806603-22556-4-git-send-email-zhang.zhanghailiang@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 1272 bytes --]
On 10/31/2014 07:50 PM, zhanghailiang wrote:
> Convert several Character backend open functions to use the Error API.
>
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> ---
> qemu-char.c | 52 +++++++++++++++++++++++++++-------------------------
> 1 file changed, 27 insertions(+), 25 deletions(-)
> @@ -2337,12 +2339,12 @@ static CharDriverState *qemu_chr_open_stdio(ChardevStdio *opts)
> if (stdio->hInputThread == INVALID_HANDLE_VALUE
> || stdio->hInputReadyEvent == INVALID_HANDLE_VALUE
> || stdio->hInputDoneEvent == 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.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]
next prev parent reply other threads:[~2014-11-01 15:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-01 1:49 [Qemu-devel] [PATCH 0/4] Trivial patches about qemu-char zhanghailiang
2014-11-01 1:50 ` [Qemu-devel] [PATCH 1/4] qemu-char: fix parameter check for qemu_chr_open_pipe zhanghailiang
2014-11-02 5:18 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-11-03 2:59 ` zhanghailiang
2014-11-01 1:50 ` [Qemu-devel] [PATCH 2/4] spice-qemu-char: fix check for in-parameter zhanghailiang
2014-11-02 6:50 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-11-03 3:00 ` zhanghailiang
2014-11-01 1:50 ` [Qemu-devel] [PATCH 3/4] qemu-char: convert some open functions to use Error API zhanghailiang
2014-11-01 15:18 ` Eric Blake [this message]
2014-11-03 2:46 ` zhanghailiang
2014-11-01 1:50 ` [Qemu-devel] [PATCH 4/4] spice-qemu-char: convert " zhanghailiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5454F9C7.4020208@redhat.com \
--to=eblake@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=zhang.zhanghailiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).