aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Google) <rostedt@goodmis.org>2022-06-06 15:29:53 -0400
committerSteven Rostedt (Google) <rostedt@goodmis.org>2022-06-08 11:20:47 -0400
commite8e2aeafdb1727c6b6b4b955114629da7ada62cd (patch)
treecb7b4cde6a7d586e2772d88567250ee6e7a6ef25
parent75545106144c42ddfad515244a23f023e0c42cf8 (diff)
downloadlibtracefs-e8e2aeafdb1727c6b6b4b955114629da7ada62cd.tar.gz
libtracefs sqlhist: Report errors executing the commands
If the -e option is set and the parsing succeeds but the executing does not, sqlhist exits with success. It should instead check the return of the creation of the histogram or synthetic event and return the error message on failure and not succeed. Link: https://lore.kernel.org/linux-trace-devel/20220606192953.334315-7-rostedt@goodmis.org Tested-by: Harald Seiler <hws@denx.de> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r--Documentation/libtracefs-sql.txt18
1 files changed, 14 insertions, 4 deletions
diff --git a/Documentation/libtracefs-sql.txt b/Documentation/libtracefs-sql.txt
index 5e48baa..6d606db 100644
--- a/Documentation/libtracefs-sql.txt
+++ b/Documentation/libtracefs-sql.txt
@@ -407,8 +407,13 @@ static int do_sql(const char *instance_name,
}
}
tracefs_synth_echo_cmd(&seq, synth);
- if (execute)
- tracefs_synth_create(synth);
+ if (execute) {
+ ret = tracefs_synth_create(synth);
+ if (ret < 0) {
+ fprintf(stderr, "%s\n", tracefs_error_last(NULL));
+ exit(-1);
+ }
+ }
} else {
struct tracefs_instance *instance = NULL;
struct tracefs_hist *hist;
@@ -430,8 +435,13 @@ static int do_sql(const char *instance_name,
}
}
tracefs_hist_echo_cmd(&seq, instance, hist, 0);
- if (execute)
- tracefs_hist_start(instance, hist);
+ if (execute) {
+ ret = tracefs_hist_start(instance, hist);
+ if (ret < 0) {
+ fprintf(stderr, "%s\n", tracefs_error_last(instance));
+ exit(-1);
+ }
+ }
}
tracefs_synth_free(synth);