From: Christian Brauner Date: Sun, 30 Oct 2016 12:42:37 +0000 (+0100) Subject: cgfs: skip empty entries under /proc/self/cgroup X-Git-Tag: lxc-2.1.0~275^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82a2fe03a61febcc1b2300550a70ac698cb1fd11;p=thirdparty%2Flxc.git cgfs: skip empty entries under /proc/self/cgroup If cgroupv2 is enabled either alone or together with legacy hierarchies /proc/self/cgroup can contain entries of the form: 0::/ These entries need to be skipped. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfs.c b/src/lxc/cgroups/cgfs.c index c10253bf3..a30ad9132 100644 --- a/src/lxc/cgroups/cgfs.c +++ b/src/lxc/cgroups/cgfs.c @@ -364,6 +364,14 @@ static bool find_cgroup_hierarchies(struct cgroup_meta_data *meta_data, *colon2 = '\0'; colon2 = NULL; + + /* With cgroupv2 /proc/self/cgroup can contain entries of the + * form: 0::/ + * These entries need to be skipped. + */ + if (!strcmp(colon1, "")) + continue; + hierarchy_number = strtoul(line, &colon2, 10); if (!colon2 || *colon2) continue; @@ -1685,6 +1693,14 @@ lxc_cgroup_process_info_getx(const char *proc_pid_cgroup_str, *colon2++ = '\0'; endptr = NULL; + + /* With cgroupv2 /proc/self/cgroup can contain entries of the + * form: 0::/ + * These entries need to be skipped. + */ + if (!strcmp(colon1, "")) + continue; + hierarchy_number = strtoul(line, &endptr, 10); if (!endptr || *endptr) continue;