On 16 August 2016 at 16:17, Michal Privoznik <mpriv...@redhat.com> wrote: > The solution is to teach qemu_opt_foreach() to take a shortcut if > @opts is NULL. > > Signed-off-by: Michal Privoznik <mpriv...@redhat.com> > --- > > Even after this patch I'm still unable to attach vhost-user: > > {"id": "libvirt-20", "error": {"class": "GenericError", "desc": "chardev > \"charnet2\" is not a unix socket"}} > > But at least, qemu does not crash anymore. > > util/qemu-option.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/util/qemu-option.c b/util/qemu-option.c > index 3467dc2..78be7e1 100644 > --- a/util/qemu-option.c > +++ b/util/qemu-option.c > @@ -614,6 +614,11 @@ int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc > func, void *opaque, > QemuOpt *opt; > int rc; > > + if (!opts) { > + /* Done, trivially. */ > + return 0; > + } > + > QTAILQ_FOREACH(opt, &opts->head, next) { > rc = func(opaque, opt->name, opt->str, errp); > if (rc) { > -- > 2.8.4
This seems plausible, but I don't understand our option code very well, and we seem to have a mix of "check for NULL" and "caller had better not pass NULL" in the various functions in util/qemu-option.c. Markus: how is this supposed to work? In any case something is clearly still busted in the vhost-user code, because it's expecting to get a non-NULL opts so it can properly parse the chardev, so that seems like the thing we really need to fix. thanks -- PMM