[openwrt/openwrt] netifd: add missing error checks to packet steering script
LEDE Commits
lede-commits at lists.infradead.org
Mon Apr 15 04:46:19 PDT 2024
nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/123282d9f9edf361729c2e8bb410957a6844d845
commit 123282d9f9edf361729c2e8bb410957a6844d845
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Apr 15 12:32:35 2024 +0200
netifd: add missing error checks to packet steering script
Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
.../config/netifd/files/usr/libexec/network/packet-steering.uc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc b/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc
index f146a96e41..72f96024d8 100755
--- a/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc
+++ b/package/network/config/netifd/files/usr/libexec/network/packet-steering.uc
@@ -27,6 +27,8 @@ for (let arg in ARGV) {
function task_name(pid)
{
let stat = open(`/proc/${pid}/status`, "r");
+ if (!stat)
+ return;
let line = stat.read("line");
stat.close();
return trim(split(line, "\t", 2)[1]);
@@ -35,8 +37,11 @@ function task_name(pid)
function set_task_cpu(pid, cpu) {
if (disable)
cpu = join(",", map(cpus, (cpu) => cpu.id));
+ let name = task_name(pid);
+ if (!name)
+ return;
if (debug || do_nothing)
- warn(`taskset -p -c ${cpu} ${task_name(pid)}\n`);
+ warn(`taskset -p -c ${cpu} ${name}\n`);
if (!do_nothing)
system(`taskset -p -c ${cpu} ${pid}`);
}
More information about the lede-commits
mailing list