qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: Eric Blake <eblake@redhat.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: Mon, 3 Nov 2014 10:46:11 +0800	[thread overview]
Message-ID: <5456EC73.1010402@huawei.com> (raw)
In-Reply-To: <5454F9C7.4020208@redhat.com>

On 2014/11/1 23:18, Eric Blake wrote:
> 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

OK, I got it, thanks for your explanation;)

> 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.
>

I will keep the exit, but use error_report instead, as other places in qemu.,thanks.

  reply	other threads:[~2014-11-03  2:47 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
2014-11-03  2:46     ` zhanghailiang [this message]
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=5456EC73.1010402@huawei.com \
    --to=zhang.zhanghailiang@huawei.com \
    --cc=eblake@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /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).