From ef3497646f8e80cb3bfb568c82b35dbfb8bc6517 Mon Sep 17 00:00:00 2001 From: Fernand Sieber Date: Wed, 20 Mar 2024 13:55:56 +0200 Subject: [PATCH] controllers parsing is resilient to trailing newline In older kernel versions (tested with 5.10.208), the cgroup.controllers files ends with a newline. This newline is not trimmed and as such the application later can incorrectly consider that the last controller is not supported --- src/cgroup.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cgroup.rs b/src/cgroup.rs index 1a67795..1e2151f 100644 --- a/src/cgroup.rs +++ b/src/cgroup.rs @@ -521,7 +521,7 @@ fn supported_controllers() -> Vec { let ret = fs::read_to_string(p.as_str()); ret.unwrap_or_default() .split(' ') - .map(|x| x.to_string()) + .map(|x| x.trim().to_string()) .collect::>() }