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
This commit is contained in:
Fernand Sieber
2024-03-20 13:55:56 +02:00
parent 69ef63a0ef
commit ef3497646f

View File

@@ -521,7 +521,7 @@ fn supported_controllers() -> Vec<String> {
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::<Vec<String>>()
}