On 12/12/2016 04:42 PM, Marc-André Lureau wrote: > Set errp to report errors up. > > Use error_report() to give hints about parameters on the right monitor, > instead of a direct fprintf() call. > > Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> > --- > spice-qemu-char.c | 29 +++++++++-------------------- > 1 file changed, 9 insertions(+), 20 deletions(-) >
And it's shorter! I like it. > @@ -302,8 +286,13 @@ static Chardev *qemu_chr_open_spice_vmc(const CharDriver > *driver, > } > } > if (*psubtype == NULL) { > - fprintf(stderr, "spice-qemu-char: unsupported type: %s\n", type); > - print_allowed_subtypes(); > + char *subtypes = g_strjoinv(", ", > + (gchar **)spice_server_char_device_recognized_subtypes()); > + > + error_setg(errp, "unsupported type name: %s", type); > + error_report("allowed spice char type names: %s", subtypes); However, I'm not sure if error_setg() followed by error_report() is correct; should you be using error_append_hint() instead? Markus? -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature