event_enable_disable() is a static method used internally by the tracefs_event_enable/disable() API. The returned value do not obey the description given in the documentation for some specific use-cases. Fixes: fc94d1a (libtracefs: Add tracefs_event_enable/disable() API) Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@xxxxxxxxx> --- src/tracefs-events.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tracefs-events.c b/src/tracefs-events.c index 55316c6..9adfd25 100644 --- a/src/tracefs-events.c +++ b/src/tracefs-events.c @@ -833,12 +833,12 @@ static int event_enable_disable(struct tracefs_instance *instance, regex_t system_re, event_re; char **systems; char **events = NULL; - int ret = -1; + int ret; int s, e; /* Handle all events first */ if (!system && !event) - return enable_disable_all(instance, enable); + return enable_disable_all(instance, enable) < 0 ? -1 : 0; systems = tracefs_event_systems(NULL); if (!systems) @@ -858,6 +858,7 @@ static int event_enable_disable(struct tracefs_instance *instance, } } + ret = -1; for (s = 0; systems[s]; s++) { if (system && !match(systems[s], &system_re)) continue; -- 2.27.0