From 1c6fd3b568c0b2fb8723d174a3cb5e82d261b6b0 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Wed, 26 Jun 2024 20:17:16 -0700 Subject: [PATCH] listevents: Error out on event list failures --- jevents/listevents.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/jevents/listevents.c b/jevents/listevents.c index 131bff30..7f9d3acb 100644 --- a/jevents/listevents.c +++ b/jevents/listevents.c @@ -60,13 +60,19 @@ int main(int ac, char **av) verbose = 1; } - read_events(NULL); + if (read_events(NULL) < 0) { + fprintf(stderr, "Error reading JSON data\n"); + exit(1); + } struct walk_data wd = { .match = av[1] }; walk_events(count_event, &wd); walk_perf_events(count_event, &wd); wd.events = calloc(sizeof(struct event), wd.count); walk_events(store_event, &wd); - walk_perf_events(store_event, &wd); + if (walk_perf_events(store_event, &wd) < 0) { + fprintf(stderr, "Error reading perf events\n"); + exit(1); + } qsort(wd.events, wd.count, sizeof(struct event), cmp_events); int i; for (i = 0; i < wd.count; i++) {