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 > --- > 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 -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org