[PATCH 2/3] event-test: Check for virConnectRegisterCloseCallback return value

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

 



In an unlikely event of virConnectRegisterCloseCallback failing,
the error is ignored. This is an example file and we shouldn't
get a bad example.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 examples/object-events/event-test.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c
index 240caac..c2b5cb3 100644
--- a/examples/object-events/event-test.c
+++ b/examples/object-events/event-test.c
@@ -659,8 +659,11 @@ int main(int argc, char **argv)
         goto cleanup;
     }
 
-    virConnectRegisterCloseCallback(dconn,
-                                    connectClose, NULL, NULL);
+    if (virConnectRegisterCloseCallback(dconn,
+                                        connectClose, NULL, NULL) < 0) {
+        fprintf(stderr, "Unable to register close callback\n");
+        goto cleanup;
+    }
 
     sigaction(SIGTERM, &action_stop, NULL);
     sigaction(SIGINT, &action_stop, NULL);
-- 
2.4.10

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]