diff options
author | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-11-14 17:20:23 -0500 |
---|---|---|
committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-11-14 17:37:31 -0500 |
commit | 1388ed664739b89e0221e25696b525c527c560a6 (patch) | |
tree | 6c9ef4848167f6cc8dae1c7ccab307343ec58806 | |
parent | 7c2b882ed11639736070beb97d5748942813742a (diff) | |
download | libtracefs-1388ed664739b89e0221e25696b525c527c560a6.tar.gz |
libtracefs: Do not return negative on EAGAIN for tracefs_cpu_flush_write()
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.
Link: https://lore.kernel.org/linux-trace-devel/20221114222024.2435776-2-rostedt@goodmis.org
Fixes: 26b8893efda7c ("libtracefs: Add reading of per cpu files")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r-- | src/tracefs-record.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tracefs-record.c b/src/tracefs-record.c index dbe0e9f..71d1df9 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; } |