From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> Like tracefs_cpu_flush(), when the buffer is empty, and because the reading of the buffer is done in NON_BLOCK mode, it will finish with a negative and EAGAIN. This is a successful state, do not return a negative number here. Fixes: 26b8893efda7c ("libtracefs: Add reading of per cpu files") Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx> --- src/tracefs-record.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tracefs-record.c b/src/tracefs-record.c index dbe0e9f01aad..71d1df99bb02 100644 --- a/src/tracefs-record.c +++ b/src/tracefs-record.c @@ -495,6 +495,10 @@ int tracefs_cpu_flush_write(struct tracefs_cpu *tcpu, int wfd) if (ret > 0) ret = write(wfd, buffer, ret); + /* It's OK if there's no data to read */ + if (ret < 0 && errno == EAGAIN) + ret = 0; + return ret; } -- 2.35.1