From 8992a33a02b3b5c6ee73bee0bc4ab55784a10bf2 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Sat, 17 Feb 2018 19:41:04 +0100 Subject: [PATCH] cgfsng: cgfsng_escape() Signed-off-by: Christian Brauner --- src/lxc/cgroups/cgfsng.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index badb228c6..4843580dd 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -2296,7 +2296,7 @@ static int cgfsng_nrtasks(void *hdata) return count; } -/* Only root needs to escape to the cgroup of its init */ +/* Only root needs to escape to the cgroup of its init. */ static bool cgfsng_escape() { int i; @@ -2305,11 +2305,15 @@ static bool cgfsng_escape() return true; for (i = 0; hierarchies[i]; i++) { - char *fullpath = must_make_path(hierarchies[i]->mountpoint, - hierarchies[i]->base_cgroup, - "cgroup.procs", NULL); - if (lxc_write_to_file(fullpath, "0", 2, false) != 0) { - SYSERROR("Failed to escape to %s", fullpath); + int ret; + char *fullpath; + + fullpath = must_make_path(hierarchies[i]->mountpoint, + hierarchies[i]->base_cgroup, + "cgroup.procs", NULL); + ret = lxc_write_to_file(fullpath, "0", 2, false); + if (ret != 0) { + SYSERROR("Failed to escape to cgroup \"%s\"", fullpath); free(fullpath); return false; } -- 2.47.2