]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Fix automatic mounts without a rootfs
authorDavid Ward <david.ward@ll.mit.edu>
Tue, 23 Jun 2015 14:57:22 +0000 (10:57 -0400)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Thu, 27 Aug 2015 21:36:50 +0000 (16:36 -0500)
Signed-off-by: David Ward <david.ward@ll.mit.edu>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/conf.c

index 30b84921bd6e7206fe18333ce99fd197a9f85b95..f298226c3e52de5c090d72965dacd94aee132174 100644 (file)
@@ -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;
                }