From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48957) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xl7fV-0005z2-Mf for qemu-devel@nongnu.org; Sun, 02 Nov 2014 21:47:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xl7fQ-0006BL-Qx for qemu-devel@nongnu.org; Sun, 02 Nov 2014 21:46:57 -0500 Message-ID: <5456EC73.1010402@huawei.com> Date: Mon, 3 Nov 2014 10:46:11 +0800 From: zhanghailiang 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> <5454F9C7.4020208@redhat.com> In-Reply-To: <5454F9C7.4020208@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit 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: Eric Blake , qemu-trivial@nongnu.org Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, peter.huangpeng@huawei.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 >> --- >> 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.