Fix: lttng_triggers count is not equal to the size of the sorted trigger array
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 28 May 2021 18:32:37 +0000 (14:32 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 30 Jun 2021 16:13:11 +0000 (12:13 -0400)
Since anonymous triggers can be present in the original lttng_triggers
and that we do not add them to the sorting list, the count to be used
while iterating on the sorted list must be the size of the list itself
and not that of lttng_triggers.

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

src/bin/lttng/commands/list_triggers.c

index 59db1c5d4b8b499fbd81a5fe10c9ccf9c374da7b..a34323b5e158a268d067e13fb02bf742ce4c9838 100644 (file)
@@ -1191,9 +1191,10 @@ static int print_sorted_triggers(const struct lttng_triggers *triggers)
                        sizeof(struct lttng_trigger *),
                        compare_triggers_by_name);
 
-       for (i = 0; i < num_triggers; i++) {
-               const struct lttng_trigger *trigger_to_print =
-                               (const struct lttng_trigger *)
+       for (i = 0; i < lttng_dynamic_pointer_array_get_count(&sorted_triggers);
+                       i++) {
+               const struct lttng_trigger *trigger_to_print = (const struct lttng_trigger
+                                               *)
                                lttng_dynamic_pointer_array_get_pointer(
                                                &sorted_triggers, i);
 
This page took 0.025875 seconds and 4 git commands to generate.