]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups: use hidden directory for attaching cgroup 3335/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 27 Mar 2020 21:22:05 +0000 (22:22 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 27 Mar 2020 21:22:05 +0000 (22:22 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index d326a87e2110af3006410e9dd7d12387147f89ad..effbf11a8735cb8322a2e8930d0bfbb659a2566e 100644 (file)
@@ -2065,12 +2065,12 @@ static int cgroup_attach_leaf(const struct lxc_conf *conf, int unified_fd, pid_t
        size_t pidstr_len;
 
        /* Create leaf cgroup. */
-       ret = mkdirat(unified_fd, "lxc", 0755);
+       ret = mkdirat(unified_fd, ".lxc", 0755);
        if (ret < 0 && errno != EEXIST)
-               return log_error_errno(-1, errno, "Failed to create leaf cgroup \"lxc\"");
+               return log_error_errno(-1, errno, "Failed to create leaf cgroup \".lxc\"");
 
        pidstr_len = sprintf(pidstr, INT64_FMT, (int64_t)pid);
-       ret = lxc_writeat(unified_fd, "lxc/cgroup.procs", pidstr, pidstr_len);
+       ret = lxc_writeat(unified_fd, ".lxc/cgroup.procs", pidstr, pidstr_len);
        if (ret < 0)
                ret = lxc_writeat(unified_fd, "cgroup.procs", pidstr, pidstr_len);
        if (ret == 0)
@@ -2082,10 +2082,11 @@ static int cgroup_attach_leaf(const struct lxc_conf *conf, int unified_fd, pid_t
 
        do {
                bool rm = false;
-               char attach_cgroup[STRLITERALLEN("lxc-1000/cgroup.procs") + 1];
+               char attach_cgroup[STRLITERALLEN(".lxc-1000/cgroup.procs") + 1];
                char *slash;
 
-               sprintf(attach_cgroup, "lxc-%d/cgroup.procs", idx);
+               snprintf(attach_cgroup, STRLITERALLEN(".lxc-%d/cgroup.procs"),
+                        ".lxc-%d/cgroup.procs", idx);
                slash = &attach_cgroup[ret] - STRLITERALLEN("/cgroup.procs");
                *slash = '\0';