linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libtracefs: Have tracefs_tracer_set() return zero on success
@ 2022-11-15  5:00 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2022-11-15  5:00 UTC (permalink / raw)
  To: Linux Trace Devel

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The tracefs_tracer_set() does a ret = write() to write the tracer name
into the current_tracer file, but then it returns the ret as well. "write"
returns the number of bytes written, but tracefs_tracer_set() is suppose
to return 0 on success.

Have it return 0 instead of the number of bytes written on success.

Fixes: df130d4915b15 ("libtracefs: Add support for setting tracers")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/tracefs-tools.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tracefs-tools.c b/src/tracefs-tools.c
index 489be28a3b94..8e7b46db86e9 100644
--- a/src/tracefs-tools.c
+++ b/src/tracefs-tools.c
@@ -1055,7 +1055,7 @@ int tracefs_tracer_set(struct tracefs_instance *instance,
  out:
 	tracefs_put_tracing_file(tracer_path);
 	close(fd);
-	return ret;
+	return ret > 0 ? 0 : ret;
 }
 
 int  tracefs_tracer_clear(struct tracefs_instance *instance)
-- 
2.35.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-15  4:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-15  5:00 [PATCH] libtracefs: Have tracefs_tracer_set() return zero on success Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).