On 10/12/2015 02:03 AM, Paolo Bonzini wrote: > Signed-off-by: Paolo Bonzini <[email protected]> > --- > qemu-char.c | 37 +++++++++++++++++++++---------------- > 1 file changed, 21 insertions(+), 16 deletions(-) > > diff --git a/qemu-char.c b/qemu-char.c > index 84cb8d0..3545cd8 100644 > --- a/qemu-char.c > +++ b/qemu-char.c > @@ -1078,18 +1078,17 @@ static CharDriverState *qemu_chr_open_fd(int fd_in, > int fd_out) > return chr; > } > > -static CharDriverState *qemu_chr_open_pipe(ChardevHostdev *opts) > +static CharDriverState *qemu_chr_open_pipe(const char *id, > + ChardevBackend *backend, > + ChardevReturn *ret, > + Error **errp) > { > + ChardevHostdev *opts = backend->pipe; > int fd_in, fd_out; > char filename_in[CHR_MAX_FILENAME_SIZE]; > char filename_out[CHR_MAX_FILENAME_SIZE]; > const char *filename = opts->device; > > - if (filename == NULL) { > - fprintf(stderr, "chardev: pipe: no filename given\n"); > - return NULL; > - } > - > snprintf(filename_in, CHR_MAX_FILENAME_SIZE, "%s.in", filename);
Do we need assert(filename) here?
> @@ -2096,12 +2097,12 @@ static int win_chr_pipe_init(CharDriverState *chr,
> const char *filename)
>
> s->hsend = CreateEvent(NULL, TRUE, FALSE, NULL);
> if (!s->hsend) {
> - fprintf(stderr, "Failed CreateEvent\n");
> + error_setg(errp, "Failed CreateEvent\n");
> goto fail;
> }
> s->hrecv = CreateEvent(NULL, TRUE, FALSE, NULL);
> if (!s->hrecv) {
> - fprintf(stderr, "Failed CreateEvent\n");
> + error_setg(errp, "Failed CreateEvent\n");
> goto fail;
Drop the trailing \n, here and throughout this file
> @@ -4277,7 +4282,7 @@ ChardevReturn *qmp_chardev_add(const char *id,
> ChardevBackend *backend,
> abort();
> break;
> case CHARDEV_BACKEND_KIND_PIPE:
> - chr = qemu_chr_open_pipe(backend->pipe);
> + abort();
> break;
another dead break
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
