From 6283549225e210dea24e3f896d4482cb28a8e2d4 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.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/examples/trigger-condition-event-matches/notification-client.c b/doc/examples/trigger-condition-event-matches/notification-client.c index 7437b6a3c..447299508 100644 --- a/doc/examples/trigger-condition-event-matches/notification-client.c +++ b/doc/examples/trigger-condition-event-matches/notification-client.c @@ -513,6 +513,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"); @@ -522,12 +527,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