From bdfd0a8e966634bb14999ff7d3729a08881485e8 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Thu, 31 Mar 2022 09:44:24 -0400 Subject: [PATCH] Fix: example: print_notification is called on status all returned status MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The notification should only be printed for `LTTNG_NOTIFICATION_CHANNEL_STATUS_OK`. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: I5534406d8fbd5c0fff7013fda6335d54bef071a2 --- .../notification-client.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/examples/trigger-condition-event-matches/notification-client.cpp b/doc/examples/trigger-condition-event-matches/notification-client.cpp index d1d5d8721..bce5d815d 100644 --- a/doc/examples/trigger-condition-event-matches/notification-client.cpp +++ b/doc/examples/trigger-condition-event-matches/notification-client.cpp @@ -514,6 +514,11 @@ int main(int argc, char **argv) ret = 0; goto end; case LTTNG_NOTIFICATION_CHANNEL_STATUS_OK: + ret = print_notification(notification); + lttng_notification_destroy(notification); + if (ret) { + goto end; + } break; case LTTNG_NOTIFICATION_CHANNEL_STATUS_CLOSED: printf("Notification channel was closed by peer.\n"); @@ -523,12 +528,6 @@ int main(int argc, char **argv) ret = -1; goto end; } - - ret = print_notification(notification); - lttng_notification_destroy(notification); - if (ret) { - goto end; - } } end: lttng_triggers_destroy(triggers); -- 2.34.1