[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [Qemu-devel] [PATCH 3/4] qemu-char: convert some open

From: zhanghailiang
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH 3/4] qemu-char: convert some open functions to use Error API
Date: Mon, 3 Nov 2014 10:46:11 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.1.1

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 <address@hidden>
  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");

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 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]