From: David Ward Date: Tue, 23 Jun 2015 14:57:36 +0000 (-0400) Subject: Fix automatic mounts without a rootfs X-Git-Tag: lxc-1.0.8~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e9fd6b03438eee2e525a38dc7b2194ec8cbe229;p=thirdparty%2Flxc.git Fix automatic mounts without a rootfs Signed-off-by: David Ward Acked-by: Serge E. Hallyn --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 16d07d009..a92e01da4 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -776,7 +776,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; @@ -784,7 +784,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"); @@ -838,7 +838,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; }