]> 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:36 +0000 (10:57 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 27 Aug 2015 21:50:26 +0000 (17:50 -0400)
Signed-off-by: David Ward <david.ward@ll.mit.edu>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/conf.c

index 16d07d009af603d98dba8c9ee0a1e549ab5ee395..a92e01da4fe7cec4103713418f7418a3492e558b 100644 (file)
@@ -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;
                }