[Qemu-devel] [PATCH 03/17] char/spice: Pass local error object pointer to error_append_hint()

Greg Kurz posted 17 patches 6 years, 1 month ago
Maintainers: Yuval Shaia <yuval.shaia@oracle.com>, Eric Blake <eblake@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Halil Pasic <pasic@linux.ibm.com>, Markus Armbruster <armbru@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, David Gibson <david@gibson.dropbear.id.au>, John Snow <jsnow@redhat.com>, Fam Zheng <fam@euphon.net>, Richard Henderson <rth@twiddle.net>, Jeff Cody <codyprime@gmail.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Gerd Hoffmann <kraxel@redhat.com>, Max Reitz <mreitz@redhat.com>, Subbaraya Sundeep <sundeep.lkml@gmail.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Eric Farman <farman@linux.ibm.com>, Peter Maydell <peter.maydell@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Christian Borntraeger <borntraeger@de.ibm.com>, Juan Quintela <quintela@redhat.com>, Alex Williamson <alex.williamson@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Michael Roth <mdroth@linux.vnet.ibm.com>, David Hildenbrand <david@redhat.com>, Cornelia Huck <cohuck@redhat.com>
[Qemu-devel] [PATCH 03/17] char/spice: Pass local error object pointer to error_append_hint()
Posted by Greg Kurz 6 years, 1 month ago
Ensure that hints are added even if errp is &error_fatal or &error_abort.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 chardev/spice.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/chardev/spice.c b/chardev/spice.c
index 241e2b7770eb..ed5996467c32 100644
--- a/chardev/spice.c
+++ b/chardev/spice.c
@@ -279,10 +279,12 @@ static void qemu_chr_open_spice_vmc(Chardev *chr,
     if (*psubtype == NULL) {
         char *subtypes = g_strjoinv(", ",
             (gchar **)spice_server_char_device_recognized_subtypes());
+        Error *local_err = NULL;
 
-        error_setg(errp, "unsupported type name: %s", type);
-        error_append_hint(errp, "allowed spice char type names: %s\n",
+        error_setg(&local_err, "unsupported type name: %s", type);
+        error_append_hint(&local_err, "allowed spice char type names: %s\n",
                           subtypes);
+        error_propagate(errp, local_err);
 
         g_free(subtypes);
         return;