[PATCH 2/2] dom event example: Add error check to impl call

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

 



From: "Jesse J. Cook" <jesse.j.cook@xxxxxxxxxxxxxx>

Added error checking to virEventRegisterDefaultImpl call for consistency.
---
 examples/domain-events/events-c/event-test.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c
index 09ec6aa..046c36e 100644
--- a/examples/domain-events/events-c/event-test.c
+++ b/examples/domain-events/events-c/event-test.c
@@ -474,7 +474,11 @@ int main(int argc, char **argv)
                 err && err->message ? err->message: "Unknown error");
     }
 
-    virEventRegisterDefaultImpl();
+    if(0 != virEventRegisterDefaultImpl()) {
+        virErrorPtr err = virGetLastError();
+        fprintf(stderr, "Failed to register event implementation: %s\n",
+                err && err->message ? err->message: "Unknown error");
+    }
 
     virConnectPtr dconn = NULL;
     dconn = virConnectOpenAuth(argc > 1 ? argv[1] : NULL,
-- 
1.7.10.4

--
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]