From: Christian Brauner Date: Fri, 5 Aug 2016 22:45:07 +0000 (+0200) Subject: bindings: adapt caller_is_in_ancestor() X-Git-Tag: lxcfs-3.0.0.beta1~50^2~13 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=12c312687d5cac3c7bc38f91af7dfbf0531945f1;p=mirror_lxcfs.git bindings: adapt caller_is_in_ancestor() Signed-off-by: Christian Brauner --- diff --git a/bindings.c b/bindings.c index 63c3d1e..7f15cad 100644 --- a/bindings.c +++ b/bindings.c @@ -1323,10 +1323,18 @@ static bool caller_is_in_ancestor(pid_t pid, const char *contrl, const char *cg, prune_init_slice(c2); /* - * callers pass in '/' for root cgroup, otherwise they pass - * in a cgroup without leading '/' + * callers pass in '/' or './' (openat()) for root cgroup, otherwise + * they pass in a cgroup without leading '/' + * + * The original line here was: + * linecmp = *cg == '/' ? c2 : c2+1; + * TODO: I'm not sure why you'd want to increment when *cg != '/'? + * Serge, do you know? */ - linecmp = *cg == '/' ? c2 : c2+1; + if (*cg == '/' || !strncmp(cg, "./", 2)) + linecmp = c2; + else + linecmp = c2 + 1; if (strncmp(linecmp, cg, strlen(linecmp)) != 0) { if (nextcg) { *nextcg = get_next_cgroup_dir(linecmp, cg);