From 8e3309deb0d184ee81d704fbf0114ecf158c5255 Mon Sep 17 00:00:00 2001 From: David Ward Date: Tue, 23 Jun 2015 10:57:22 -0400 Subject: [PATCH] Fix automatic mounts without a rootfs Signed-off-by: David Ward Acked-by: Serge E. Hallyn --- src/lxc/conf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 4085b2694..ea63e89e2 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -790,7 +790,7 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha if (default_mounts[i].source) { /* will act like strdup if %r is not present */ - source = lxc_string_replace("%r", conf->rootfs.mount, default_mounts[i].source); + source = lxc_string_replace("%r", conf->rootfs.path ? conf->rootfs.mount : "", default_mounts[i].source); if (!source) { SYSERROR("memory allocation error"); return -1; @@ -798,7 +798,7 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha } if (default_mounts[i].destination) { /* will act like strdup if %r is not present */ - destination = lxc_string_replace("%r", conf->rootfs.mount, default_mounts[i].destination); + destination = lxc_string_replace("%r", conf->rootfs.path ? conf->rootfs.mount : "", default_mounts[i].destination); if (!destination) { saved_errno = errno; SYSERROR("memory allocation error"); @@ -853,7 +853,7 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha } } - if (!cgroup_mount(conf->rootfs.mount, handler, cg_flags)) { + if (!cgroup_mount(conf->rootfs.path ? conf->rootfs.mount : "", handler, cg_flags)) { SYSERROR("error mounting /sys/fs/cgroup"); return -1; } -- 2.47.3