Skip to contentSkip to conversation

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

PATCH New Steven Rostedt 1 participant 1 message Jun 22, 2021

lore
Share & tools
lore
#0 lore raw

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

From: "Steven Rostedt (VMware)" <[email protected]>

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.

---
 tracecmd/trace-split.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tracecmd/trace-split.c +2 -1
index 10d0943d..233feb89 100644
@@ -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++) {
Signature · 1 line
2.29.2