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-Url: http://drtracing.org/?a=commitdiff_plain;h=bdfd0a8e966634bb14999ff7d3729a08881485e8;p=deliverable%2Flttng-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.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);