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

[libvirt] [libvirt-glib 2/2] conn-test: Fix gvir_connection_get_version error check



This method returns a version number, which can be 0, so we cannot
check the return value for 0 to know if an error happened. Test if
the GError is set instead to detect errors.
---
 examples/conn-test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/examples/conn-test.c b/examples/conn-test.c
index b98d115..3e0e148 100644
--- a/examples/conn-test.c
+++ b/examples/conn-test.c
@@ -47,7 +47,8 @@ do_connection_open(GObject *source,
 
     g_print("Hypervisor name: %s\n", hv_name);
 
-    if (!(hv_version = gvir_connection_get_version(conn, &err))) {
+    hv_version = gvir_connection_get_version(conn, &err);
+    if (err != NULL) {
         g_error("%s", err->message);
     }
 
-- 
1.8.0


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