From f7d00a84dc664892e8ee733d79bc6b691f2f0ea4 Mon Sep 17 00:00:00 2001 From: Eliad Peller Date: Sun, 5 Nov 2023 09:16:28 +0200 Subject: [PATCH] cgroups: skip empty controllers 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 --- procfs-core/src/cgroups.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/procfs-core/src/cgroups.rs b/procfs-core/src/cgroups.rs index 71ae906..8f3201b 100644 --- a/procfs-core/src/cgroups.rs +++ b/procfs-core/src/cgroups.rs @@ -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();