From cbe289d814dda6095bd0482249846d9fe70d999d Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 16 Mar 2016 09:32:44 +0100 Subject: [PATCH] event-test: Check for virConnectRegisterCloseCallback return value 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 --- 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 81830c7914..7be1d21e1b 100644 --- a/examples/object-events/event-test.c +++ b/examples/object-events/event-test.c @@ -668,8 +668,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); -- GitLab