[Spice-devel] [PATCH spice-gtk 3/3] Remove "usbredirhost error: " prefix from usbredirhost error messages

Hans de Goede hdegoede at redhat.com
Sat Jul 28 02:40:11 PDT 2012


libusbredirhost prefixes all its messages with "usbredirhhost ...: ", which
is useful when logging to stderr, but not so much when showing the error
to the user in an error dialog, so remove the "usbredirhost error: " prefix
when we store the message in a GError.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 gtk/channel-usbredir.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gtk/channel-usbredir.c b/gtk/channel-usbredir.c
index 354d2e1..cb2aed3 100644
--- a/gtk/channel-usbredir.c
+++ b/gtk/channel-usbredir.c
@@ -448,8 +448,13 @@ static void usbredir_log(void *user_data, int level, const char *msg)
 
     if (priv->catch_error && level == usbredirparser_error) {
         SPICE_DEBUG("%s", msg);
-        g_set_error_literal(priv->catch_error, SPICE_CLIENT_ERROR,
-                            SPICE_CLIENT_ERROR_FAILED, msg);
+        /* Remove "usbredirhost..." prefix from usbredirhost error messages */
+        if (strncmp(msg, "usbredirhost error: ", 20) == 0)
+            g_set_error_literal(priv->catch_error, SPICE_CLIENT_ERROR,
+                                SPICE_CLIENT_ERROR_FAILED, msg + 20);
+        else
+            g_set_error_literal(priv->catch_error, SPICE_CLIENT_ERROR,
+                                SPICE_CLIENT_ERROR_FAILED, msg);
         return;
     }
 
-- 
1.7.10.4



More information about the Spice-devel mailing list