libtracefs/libtracefs-Fix-the-read-file-failure-code-checking.patch
Tomas Glozar 9912f64a58 Fix read file failure code checking
A bug fixed in libtrace 1.8.2 breaks trace sample processing on
machines with a large number of CPUs. Backport patch that fixes this
issue.

Resolves: RHEL-93863
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
2025-06-02 13:10:17 +02:00

32 lines
1.0 KiB
Diff

From 3f5dc533a8306527b77bcf9187768ba0eaf910b6 Mon Sep 17 00:00:00 2001
From: Haiyue Wang <haiyuewa@163.com>
Date: Fri, 14 Feb 2025 20:35:17 +0800
Subject: [PATCH] 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.
Link: https://lore.kernel.org/20250214123531.13883-1-haiyuewa@163.com
Signed-off-by: Haiyue Wang <haiyuewa@163.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
src/tracefs-record.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tracefs-record.c b/src/tracefs-record.c
index 932e8b4..1a4a16c 100644
--- a/src/tracefs-record.c
+++ b/src/tracefs-record.c
@@ -550,7 +550,7 @@ static int init_splice(struct tracefs_cpu *tcpu)
if (ret < 0)
return ret;
- if (str_read_file("/proc/sys/fs/pipe-max-size", &buf, false)) {
+ if (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);
--
2.49.0