Fix: example: print_notification is called on status all returned status
[lttng-tools.git] / doc / examples / trigger-condition-event-matches / notification-client.cpp
index 4a251556938d335630652d3208d599ecceb78a54..bce5d815d991590bde3a54ce60f0fde228894f29 100644 (file)
@@ -16,7 +16,7 @@
 #include <sys/time.h>
 #include <time.h>
 
-#include <common/macros.h>
+#include <common/macros.hpp>
 
 static int print_capture(const struct lttng_condition *condition,
                const struct lttng_event_field_value *capture,
@@ -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);
This page took 0.02941 seconds and 4 git commands to generate.