cgfsng: add container name to lxc.cgroup.dir value

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: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent a17f8b3f
...@@ -1345,11 +1345,11 @@ static void remove_path_for_hierarchy(struct hierarchy *h, char *cgname) ...@@ -1345,11 +1345,11 @@ static void remove_path_for_hierarchy(struct hierarchy *h, char *cgname)
*/ */
static inline bool cgfsng_create(void *hdata) static inline bool cgfsng_create(void *hdata)
{ {
struct cgfsng_handler_data *d = hdata;
char *tmp, *cgname, *offset;
int i; int i;
int idx = 0;
size_t len; size_t len;
char *cgname, *offset, *tmp;
int idx = 0;
struct cgfsng_handler_data *d = hdata;
if (!d) if (!d)
return false; return false;
...@@ -1360,7 +1360,7 @@ static inline bool cgfsng_create(void *hdata) ...@@ -1360,7 +1360,7 @@ static inline bool cgfsng_create(void *hdata)
} }
if (d->cgroup_meta.dir) 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 else
tmp = lxc_string_replace("%n", d->name, d->cgroup_pattern); tmp = lxc_string_replace("%n", d->name, d->cgroup_pattern);
if (!tmp) { if (!tmp) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment