Skip to content

Commit

Permalink
controllers parsing is resilient to trailing newline
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Fernand Sieber committed Mar 20, 2024
1 parent 69ef63a commit ef34976
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cgroup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>>()
}

Expand Down

0 comments on commit ef34976

Please # to comment.