diff mbox series

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

Message ID 20230710123914.5a58be62@gandalf.local.home (mailing list archive)
State Accepted
Commit 354dccca52e805ce1b22e2b62cbae8c265886c27
Headers show
Series trace-cmd split: Do not append '.1' to single file if output specified | expand

Commit Message

Steven Rostedt July 10, 2023, 4:39 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

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.

Link: https://lore.kernel.org/linux-trace-users/VE1PR09MB3535FFA94A0481583EF7992CF230A@VE1PR09MB3535.eurprd09.prod.outlook.com/

Suggested-by: Sharon Gabay <Sharon.Gabay@mobileye.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 tracecmd/trace-split.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tracecmd/trace-split.c b/tracecmd/trace-split.c
index 1daa847d9775..59df1d02b345 100644
--- a/tracecmd/trace-split.c
+++ b/tracecmd/trace-split.c
@@ -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");
 	}