From: Jonathan Rajotte Date: Thu, 31 Mar 2022 13:44:24 +0000 (-0400) Subject: Fix: example: print_notification is called on status all returned status X-Git-Tag: v2.13.7~6 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6283549225e210dea24e3f896d4482cb28a8e2d4;p=lttng-tools.git Fix: example: print_notification is called on status all returned status 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 --- 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);