[PATCH 2/3] trace-cmd library: Add back setting errno to zero in tracecmd_stack_tracer_status()

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

 



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

A clean up was made to remove all the settings of errno to zero in the
library, but it was a bit too aggressive in doing so. It removed the errno
setting to zero in tracecmd_stack_tracer_status() just before it called
strtol() which it uses to test for the success of that function. By not
clearing errno, it was causing trace-cmd stat to report:

 "Error reading stack tracer status"

Fixes: dcd5ee3142 ("libtracecmd: Do not set errno to zero")
Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
 lib/trace-cmd/trace-util.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/trace-cmd/trace-util.c b/lib/trace-cmd/trace-util.c
index fc61f9d1111b..b5002f1daa07 100644
--- a/lib/trace-cmd/trace-util.c
+++ b/lib/trace-cmd/trace-util.c
@@ -557,6 +557,7 @@ int tracecmd_stack_tracer_status(int *status)
 
 	buf[n] = 0;
 
+	errno = 0;
 	num = strtol(buf, NULL, 10);
 
 	/* Check for various possible errors */
-- 
2.42.0





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

  Powered by Linux