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.zhanghaili...@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: signature.asc
Description: OpenPGP digital signature

Reply via email to