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

From: Jovanka Gulicoska <jovanka.gulicoska@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

Ping? On Wed, Sep 12, 2012 at 04:22:04PM +0200, Christophe Fergeau wrote:
From: Jovanka Gulicoska <jovanka.gulicoska@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@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 12.09.2012 16:22, Christophe Fergeau wrote:
From: Jovanka Gulicoska <jovanka.gulicoska@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(-)
ACK Michal
participants (2)
-
Christophe Fergeau
-
Michal Privoznik