Skip to contentSkip to conversation

trace-cmd split: Do not append '.1' to single file if output specified

PATCH New Steven Rostedt 1 participant 1 message Jul 10, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd split: Do not append '.1' to single file if output specified

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

If the user specifies an output file, and it is not the same as the input file, and the '-r' (repeat) option is not specified, there's no reason to append the '.1' to the output file name. Just use what the user specified.

---
 tracecmd/trace-split.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tracecmd/trace-split.c +1 -1
index 1daa847d9775..59df1d02b345 100644
@@ -545,7 +545,7 @@ void trace_split (int argc, char **argv)
 	if (!output)
 		output = strdup(input_file);
 
-	if (!repeat) {
+	if (!repeat && strcmp(output, input_file) == 0) {
 		output = realloc(output, strlen(output) + 3);
 		strcat(output, ".1");
 	}
Signature · 1 line
2.39.2