]> git.proxmox.com Git - mirror_lxc.git/commitdiff
cgfsng: add container name to lxc.cgroup.dir value
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 25 Aug 2017 09:51:05 +0000 (11:51 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 27 Aug 2017 15:51:26 +0000 (17:51 +0200)
Say we have

    lxc.uts.name = c1
    lxc.cgroup.dir = lxd

the actual path should be

    lxd/c1

Right now it would just be

    lxd

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index e137b33c09409689608cf4acf4eaa52037da0519..fe3fd7062a442fe72e3166011aad6f1dd5595481 100644 (file)
@@ -1345,11 +1345,11 @@ static void remove_path_for_hierarchy(struct hierarchy *h, char *cgname)
  */
 static inline bool cgfsng_create(void *hdata)
 {
-       struct cgfsng_handler_data *d = hdata;
-       char *tmp, *cgname, *offset;
        int i;
-       int idx = 0;
        size_t len;
+       char *cgname, *offset, *tmp;
+       int idx = 0;
+       struct cgfsng_handler_data *d = hdata;
 
        if (!d)
                return false;
@@ -1360,7 +1360,7 @@ static inline bool cgfsng_create(void *hdata)
        }
 
        if (d->cgroup_meta.dir)
-               tmp = strdup(d->cgroup_meta.dir);
+               tmp = lxc_string_join("/", (const char *[]){d->cgroup_meta.dir, d->name, NULL}, false);
        else
                tmp = lxc_string_replace("%n", d->name, d->cgroup_pattern);
        if (!tmp) {