[Spice-devel] [PATCH spice-gtk] webdav: check g_output_stream_write_all() return value

Marc-André Lureau marcandre.lureau at redhat.com
Wed May 6 08:59:25 PDT 2015


Check g_output_stream_write_all() return value to silence a coverity
CHECKED_RETURN warning
---
 gtk/channel-webdav.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gtk/channel-webdav.c b/gtk/channel-webdav.c
index 95c0521..1d3862e 100644
--- a/gtk/channel-webdav.c
+++ b/gtk/channel-webdav.c
@@ -147,8 +147,7 @@ static gboolean output_queue_idle(gpointer user_data)
         return FALSE;
     }
 
-    g_output_stream_write_all(q->output, e->buf, e->size, NULL, NULL, &error);
-    if (error)
+    if (!g_output_stream_write_all(q->output, e->buf, e->size, NULL, NULL, &error))
         goto err;
     else if (e->pushed_cb)
         e->pushed_cb(q, e->user_data);
@@ -159,7 +158,9 @@ static gboolean output_queue_idle(gpointer user_data)
     return TRUE;
 
 err:
-    g_warning("error: %s", error->message);
+    g_warning("failed to write to output stream");
+    if (error)
+        g_warning("error: %s", error->message);
     g_clear_error(&error);
 
     q->idle_id = 0;
-- 
2.1.0



More information about the Spice-devel mailing list