mirror of
https://github.com/kata-containers/cgroups-rs.git
synced 2026-08-05 02:13:23 +00:00
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:
@@ -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>>()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user