[libvirt] [libvirt-glib] Don't call g_set_error with a NULL format string

Christophe Fergeau cfergeau at redhat.com
Tue Sep 25 09:08:53 UTC 2012


Ping?

On Wed, Sep 12, 2012 at 04:22:04PM +0200, Christophe Fergeau wrote:
> From: Jovanka Gulicoska <jovanka.gulicoska at gmail.com>
> 
> The format string passed to g_set_error cannot be NULL or a runtime
> warning will be printed.
> ---
>  libvirt-gobject/libvirt-gobject-stream.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-stream.c b/libvirt-gobject/libvirt-gobject-stream.c
> index 3b98023..fa1a32c 100644
> --- a/libvirt-gobject/libvirt-gobject-stream.c
> +++ b/libvirt-gobject/libvirt-gobject-stream.c
> @@ -319,7 +319,8 @@ gssize gvir_stream_receive(GVirStream *self,
>      got = virStreamRecv(self->priv->handle, buffer, size);
>  
>      if (got == -2) {  /* blocking */
> -        g_set_error(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK, NULL);
> +        g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK,
> +                            "virStreamRecv call would block");
>      } else if (got < 0) {
>          g_set_error(error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
>                      "Got virStreamRecv error in %s", G_STRFUNC);
> @@ -435,7 +436,8 @@ gssize gvir_stream_send(GVirStream *self,
>      got = virStreamSend(self->priv->handle, buffer, size);
>  
>      if (got == -2) {  /* blocking */
> -        g_set_error(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK, NULL);
> +        g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK,
> +                            "virStreamSend call would block");
>      } else if (got < 0) {
>          g_set_error(error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
>                      "Got virStreamRecv error in %s", G_STRFUNC);
> -- 
> 1.7.11.4
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120925/34886603/attachment-0001.sig>


More information about the libvir-list mailing list