Skip to content

Commit

Permalink
cgfsng: fix lxc.pivot directory creation
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Oct 9, 2018
1 parent e2103b1 commit 23e5c04
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lxc/cgroups/cgfsng.c
Expand Up @@ -1152,6 +1152,7 @@ __cgfsng_ops static void cgfsng_monitor_destroy(struct cgroup_ops *ops,

for (int i = 0; ops->hierarchies[i]; i++) {
int ret;
char *chop;
struct hierarchy *h = ops->hierarchies[i];

if (!h->monitor_full_path)
Expand All @@ -1169,10 +1170,17 @@ __cgfsng_ops static void cgfsng_monitor_destroy(struct cgroup_ops *ops,
PIVOT_CGROUP,
"cgroup.procs", NULL);

chop = strrchr(pivot_path, '/');
if (chop)
*chop = '\0';

ret = mkdir_p(pivot_path, 0755);
if (ret < 0 && errno != EEXIST)
goto next;

if (chop)
*chop = '/';

/* Move ourselves into the pivot cgroup to delete our own
* cgroup.
*/
Expand Down

0 comments on commit 23e5c04

Please sign in to comment.