[lxc-devel] [PATCH stable-1.1 4/7] Fix automatic mounts without a rootfs

David Ward david.ward at ll.mit.edu
Tue Jun 23 14:57:29 UTC 2015


Signed-off-by: David Ward <david.ward at ll.mit.edu>
---
 src/lxc/conf.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 6650c44..69bbd20 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -779,7 +779,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;
@@ -787,7 +787,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");
@@ -842,7 +842,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;
 		}
-- 
1.7.1



More information about the lxc-devel mailing list