trace-cmd library: Have callbacks exit out of the iterator
PATCH 1/1 trace-cmd library: Have callbacks exit out of the iterator
From: "Steven Rostedt (Google)" <[email protected]>
In the man page for tracecmd_iterate_events() it states that if the callback() returns anything other than zero, it will exit the iterator. But this is not true. It only exits if the callback returns less than zero. This is a bug as the code should do what the man page states. Have it exit the loop if the callback returns non zero.
Signed-off-by Steven Rostedt (Google) <[email protected]>
--- lib/trace-cmd/trace-input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/trace-cmd/trace-input.c +2 -2
@@ -2816,7 +2816,7 @@ int tracecmd_iterate_events(struct tracecmd_input *handle, records[next_cpu] =tracecmd_peek_data (handle, next_cpu);tracecmd_free_record (record); } - }while (next_cpu >=0 && ret >=0 ); + }while (next_cpu >=0 && ret ==0 );/* Need to unlock and free the records */ for (cpu =0 ; cpu < handle->max_cpu; cpu++) {
@@ -2912,7 +2912,7 @@ int tracecmd_iterate_events_multi(struct tracecmd_input **handles, records[next_cpu].record =tracecmd_peek_data (handle, cpu); } - }while (next_cpu >=0 && ret >=0 ); + }while (next_cpu >=0 && ret ==0 );/* Unlock and free the records */ for (cpu =0 ; cpu < all_cpus; cpu++) {
Signature · 1 line
2.39.2