qemu-devel
[Top][All Lists]
Advanced

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

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


From: Eric Blake
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
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

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");
>              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: signature.asc
Description: OpenPGP digital signature


reply via email to

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