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

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



From: "Jesse J. Cook" <jesse j cook member fsf org>

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


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