mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-20 06:44:27 +01:00
get_mounts() parses /proc/self/mountinfo in order to get the mountpoints for various cgroup filesystems. One of the entries in mountinfo is the "device" for each filesystem, but for virtual filesystems like /proc, /sys and cgroups, the device entry is arbitrary. Depending on the exact rootfs setup, it can end up being "-". This breaks get_mounts() because it uses " - " as a separator. There really is a " - " separator in mountinfo, but in this case the device entry shows up as a second one. Fix this, by changing a split to a splitn, which will effectively only consider the first " - " in the line. While we're there, make the warning message more useful, by having it actually show which line it wasn't able to parse. fixes #2182 Signed-off-by: David Gibson <david@gibson.dropbear.id.au>