Blame SOURCES/0114-lib-bpf-Check-return-value-of-write.patch
|
|
36cfb7 |
From 78f4b87c3f014e378377d3ecc55d1ec46cd57b51 Mon Sep 17 00:00:00 2001
|
|
|
36cfb7 |
From: Andrea Claudi <aclaudi@redhat.com>
|
|
|
36cfb7 |
Date: Mon, 29 Apr 2019 20:08:08 +0200
|
|
|
36cfb7 |
Subject: [PATCH] lib/bpf: Check return value of write()
|
|
|
36cfb7 |
|
|
|
36cfb7 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1465646
|
|
|
36cfb7 |
Upstream Status: iproute2.git commit b5c78e1b2c868
|
|
|
36cfb7 |
|
|
|
36cfb7 |
commit b5c78e1b2c8681e82684f47563acd3d383893658
|
|
|
36cfb7 |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
36cfb7 |
Date: Thu Aug 24 11:41:29 2017 +0200
|
|
|
36cfb7 |
|
|
|
36cfb7 |
lib/bpf: Check return value of write()
|
|
|
36cfb7 |
|
|
|
36cfb7 |
This is merely to silence the compiler warning. If write to stderr
|
|
|
36cfb7 |
failed, assume that printing an error message will fail as well so don't
|
|
|
36cfb7 |
even try.
|
|
|
36cfb7 |
|
|
|
36cfb7 |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
36cfb7 |
---
|
|
|
36cfb7 |
lib/bpf.c | 3 ++-
|
|
|
36cfb7 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
36cfb7 |
|
|
|
36cfb7 |
diff --git a/lib/bpf.c b/lib/bpf.c
|
|
|
36cfb7 |
index 33c5288e82187..7eb754ad7cb56 100644
|
|
|
36cfb7 |
--- a/lib/bpf.c
|
|
|
36cfb7 |
+++ b/lib/bpf.c
|
|
|
36cfb7 |
@@ -486,7 +486,8 @@ int bpf_trace_pipe(void)
|
|
|
36cfb7 |
|
|
|
36cfb7 |
ret = read(fd, buff, sizeof(buff) - 1);
|
|
|
36cfb7 |
if (ret > 0) {
|
|
|
36cfb7 |
- write(2, buff, ret);
|
|
|
36cfb7 |
+ if (write(STDERR_FILENO, buff, ret) != ret)
|
|
|
36cfb7 |
+ return -1;
|
|
|
36cfb7 |
fflush(stderr);
|
|
|
36cfb7 |
}
|
|
|
36cfb7 |
}
|
|
|
36cfb7 |
--
|
|
|
e138d9 |
2.21.0
|
|
|
36cfb7 |
|