libtracefs: Fix the read file failure code checking
PATCH 1/1 libtracefs: Fix the read file failure code checking
The failure error code '-1' will be treated as 'true'. Only nonzero number has buffer data returned successfully.
Signed-off-by Haiyue Wang <[email protected]>
--- src/tracefs-record.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/tracefs-record.c +1 -1
@@ -550,7 +550,7 @@ static int init_splice(struct tracefs_cpu *tcpu)if (ret <0 )return ret; -if (tfs_str_read_file ("/proc/sys/fs/pipe-max-size" , &buf, false)) { +if (tfs_str_read_file ("/proc/sys/fs/pipe-max-size" , &buf, false) >0 ) {int size =atoi (buf);fcntl (tcpu->splice_pipe[0 ],F_SETPIPE_SZ , &size);free (buf);
Signature · 1 line
2.48.1