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

Pavel Grunt pgrunt at redhat.com
Wed May 6 22:54:46 PDT 2015


On Wed, 2015-05-06 at 17:59 +0200, Marc-André Lureau wrote:
> 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;

ack.

Pavel


More information about the Spice-devel mailing list