Skip to contentSkip to conversation

libtracefs: Have tracefs_tracer_set() return zero on success

PATCH New Steven Rostedt 1 participant 1 message Nov 15, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtracefs: Have tracefs_tracer_set() return zero on success

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

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")
---
 src/tracefs-tools.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/tracefs-tools.c +1 -1
index 489be28a3b94..8e7b46db86e9 100644
@@ -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)
Signature · 1 line
2.35.1