cgroups: skip v2 hierarchy entry

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
This commit is contained in:
Christian Brauner 2016-11-11 00:29:15 +01:00
parent 7a8082f47b
commit ff8d6ee936
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -686,6 +686,18 @@ static void get_existing_subsystems(char ***klist, char ***nlist)
if (!p2) if (!p2)
continue; continue;
*p2 = '\0'; *p2 = '\0';
/* If we have a mixture between cgroup v1 and cgroup v2
* hierarchies, then /proc/self/cgroup contains entries of the
* form:
*
* 0::/some/path
*
* We need to skip those.
*/
if ((p2 - p) == 0)
continue;
for (tok = strtok_r(p, ",", &saveptr); tok; for (tok = strtok_r(p, ",", &saveptr); tok;
tok = strtok_r(NULL, ",", &saveptr)) { tok = strtok_r(NULL, ",", &saveptr)) {
if (strncmp(tok, "name=", 5) == 0) if (strncmp(tok, "name=", 5) == 0)