Skip to content

Commit

Permalink
cgroups: skip empty controllers
Browse files Browse the repository at this point in the history
In case of cgroupv2, the controllers list is empty.

Splitting it by comma results in a vector with a single
empty element ([""]), instead of an empty vector ([]).

Signed-off-by: Eliad Peller <[email protected]>
  • Loading branch information
eliad-wiz committed Nov 5, 2023
1 parent 71addc0 commit f7d00a8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions procfs-core/src/cgroups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ impl crate::FromBufRead for ProcessCGroups {
let hierarchy = from_str!(u32, expect!(s.next(), "hierarchy"));
let controllers = expect!(s.next(), "controllers")
.split(',')
.filter(|s| !s.is_empty())
.map(|s| s.to_owned())
.collect();
let pathname = expect!(s.next(), "path").to_owned();
Expand Down

0 comments on commit f7d00a8

Please sign in to comment.