qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 06/21] qemu-char: convert parallel backend to da


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 06/21] qemu-char: convert parallel backend to data-driven creation
Date: Mon, 12 Oct 2015 09:13:35 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 10/12/2015 02:03 AM, Paolo Bonzini wrote:
> Conversion to Error * brings better error messages; before:
> 
>     qemu-system-x86_64: -chardev id=serial,backend=parallel,path=vl.c: Failed 
> to create chardev
> 
> After:
> 
>     qemu-system-x86_64: -chardev id=serial,backend=parallel,path=vl.c: not a 
> parallel port: Inappropriate ioctl for device
> 
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  qemu-char.c | 28 ++++++++++++++++++----------
>  1 file changed, 18 insertions(+), 10 deletions(-)
> 

> +static CharDriverState *qemu_chr_open_pp_fd(int fd, Error **errp)
>  {
>      CharDriverState *chr;
>      ParallelCharDriver *drv;
>  
>      if (ioctl(fd, PPCLAIM) < 0) {
>          close(fd);
> +        error_setg_errno(errp, errno, "not a parallel port");

Swap this line with the close(), since close() can clobber errno.


> @@ -4265,11 +4273,9 @@ ChardevReturn *qmp_chardev_add(const char *id, 
> ChardevBackend *backend,
>          case CHARDEV_BACKEND_KIND_SERIAL:
>              abort();
>              break;
> -#ifdef HAVE_CHARDEV_PARPORT
>          case CHARDEV_BACKEND_KIND_PARALLEL:
> -            chr = qmp_chardev_open_parallel(backend->parallel, &local_err);
> +            abort();
>              break;

Another dead break.

With the error reporting fixed,
Reviewed-by: Eric Blake <address@hidden>

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