Skip to content

Commit

Permalink
conf: improve lxc_clear_cgroups()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Feb 19, 2021
1 parent 1597027 commit d6c0692
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/lxc/conf.c
Expand Up @@ -3674,25 +3674,25 @@ int lxc_clear_cgroups(struct lxc_conf *c, const char *key, int version)
bool all = false;

if (version == CGROUP2_SUPER_MAGIC) {
global_token = "lxc.cgroup2";
namespaced_token = "lxc.cgroup2.";
namespaced_token_len = STRLITERALLEN("lxc.cgroup2.");
global_token = "lxc.cgroup2";
namespaced_token = "lxc.cgroup2.";
namespaced_token_len = STRLITERALLEN("lxc.cgroup2.");
list = &c->cgroup2;
} else if (version == CGROUP_SUPER_MAGIC) {
global_token = "lxc.cgroup";
namespaced_token = "lxc.cgroup.";
namespaced_token_len = STRLITERALLEN("lxc.cgroup.");
global_token = "lxc.cgroup";
namespaced_token = "lxc.cgroup.";
namespaced_token_len = STRLITERALLEN("lxc.cgroup.");
list = &c->cgroup;
} else {
return -EINVAL;
return ret_errno(EINVAL);
}

if (strequal(key, global_token))
all = true;
else if (strnequal(key, namespaced_token, namespaced_token_len))
k += namespaced_token_len;
else
return -EINVAL;
return ret_errno(EINVAL);

lxc_list_for_each_safe (it, list, next) {
struct lxc_cgroup *cg = it->elem;
Expand Down

0 comments on commit d6c0692

Please sign in to comment.