diff mbox series

trace-cmd split: Fail with an error message if appending data fails

Message ID 20210622171833.37b1e22b@gandalf.local.home (mailing list archive)
State Accepted
Commit 7cb94623d0eeaadc5d47b7ddf3f59bf1271689a4
Headers show
Series trace-cmd split: Fail with an error message if appending data fails | expand

Commit Message

Steven Rostedt June 22, 2021, 9:18 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

If appending the CPU data fails, error out with a message to inform the
user what happened and not just continue as if nothing went wrong.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tracecmd/trace-split.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tracecmd/trace-split.c b/tracecmd/trace-split.c
index 10d0943d..233feb89 100644
--- a/tracecmd/trace-split.c
+++ b/tracecmd/trace-split.c
@@ -385,7 +385,8 @@  static double parse_file(struct tracecmd_input *handle,
 		cpu_list[cpu] = cpu_data[cpu].file;
 
 	tracecmd_set_out_clock(ohandle, tracecmd_get_trace_clock(handle));
-	tracecmd_append_cpu_data(ohandle, cpus, cpu_list);
+	if (tracecmd_append_cpu_data(ohandle, cpus, cpu_list) < 0)
+		die("Failed to append tracing data\n");
 
 	current = end;
 	for (cpu = 0; cpu < cpus; cpu++) {