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 <christian.brauner@canonical.com>
*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;
*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;