Fix: example: print_notification is called on status all returned status
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 31 Mar 2022 13:44:24 +0000 (09:44 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 7 Apr 2022 14:36:04 +0000 (10:36 -0400)
The notification should only be printed for
`LTTNG_NOTIFICATION_CHANNEL_STATUS_OK`.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I5534406d8fbd5c0fff7013fda6335d54bef071a2

doc/examples/trigger-condition-event-matches/notification-client.c

index 7437b6a3cd5be880d63d384240fef3d6350afa2c..4472995088ad8264e49c34a6d10b47b5b8535261 100644 (file)
@@ -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);
This page took 0.025958 seconds and 4 git commands to generate.