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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>

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@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/

Suggested-by: Sharon Gabay <Sharon.Gabay@xxxxxxxxxxxx>
Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
 tracecmd/trace-split.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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");
 	}
-- 
2.39.2




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux