[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]