Hi On Wed, Jan 4, 2017 at 11:00 PM Eric Blake <ebl...@redhat.com> wrote:
> 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? > > That doesn't work well with command line errors. error_vprintf_unless_qmp() doesn't print if !cur_mon. I sent a patch on the ML, and I'll follow your suggestion. -- Marc-André Lureau