Skip to contentSkip to conversation

perf trace: Fix return value of trace__fprintf_tp_fields

PATCH Applied Benjamin Peterson 2 participants 2 messages Jan 23, 2025 – Jan 27, 2025 perf events

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 perf trace: Fix return value of trace__fprintf_tp_fields

This function formerly returned twice the number of bytes printed.

---
This is a small followup cleanup to my earlier commit 5fb8e56542a3 ("perf
trace: avoid garbage when not printing a trace event's arguments").

To:

---
 tools/perf/builtin-trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-trace.c +1 -1
index 6a1a128fe645014d0347ad4ec3e0c9e77ec59aee..c2e8ff48682bdc86a0a21f54f5163eb82d4cc17d 100644
@@ -3088,7 +3088,7 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel,
 		printed += syscall_arg_fmt__scnprintf_val(arg, bf + printed, size - printed, &syscall_arg, val);
 	}
 
-	return printed + fprintf(trace->output, "%.*s", (int)printed, bf);
+	return fprintf(trace->output, "%.*s", (int)printed, bf);
 }
 
 static int trace__event_handler(struct trace *trace, struct evsel *evsel,

---
base-commit: 8883957b3c9de2087fb6cf9691c1188cccf1ac9c
change-id: 20241212-void-fprintf_tp_fields-8aaae2f5525f

Best regards,

Signature · 1 line
Benjamin Peterson <[email protected]>
maintainer Applied
#1 lore raw
Quoted 3 lines · Benjamin Peterson

This function formerly returned twice the number of bytes printed.

Applied to perf-tools-next, thanks!

Best regards,
Namhyung