]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
use defined rootfs mount point
authorDaniel Lezcano <daniel.lezcano@free.fr>
Wed, 12 May 2010 21:44:28 +0000 (23:44 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Wed, 12 May 2010 21:44:28 +0000 (23:44 +0200)
As we defined a path where to mount the rootfs, we can use without
ambiguity because it is defined by default at compile time or by the
configuration.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/conf.c

index 55eb71599bfcf1f51033bf0d5fff19af04684748..57b8c1a3ca2fb19c1fd19939c9559bf2bd802499 100644 (file)
@@ -582,19 +582,28 @@ static int setup_rootfs_pivot_root(const char *rootfs, const char *pivotdir)
 
 static int setup_rootfs(const struct lxc_rootfs *rootfs)
 {
-       const char *tmpfs = "/tmp";
+       char *mpath = LXCROOTFSMOUNT;
 
        if (!rootfs->path)
                return 0;
 
-       if (mount(rootfs->path, tmpfs, "none", MS_BIND|MS_REC, NULL)) {
-               SYSERROR("failed to mount '%s'->'%s'", rootfs->path, "/tmp");
+       if (rootfs->mount)
+               mpath = rootfs->mount;
+
+       if (access(mpath, F_OK)) {
+               SYSERROR("failed to access to '%s', check it is present",
+                        mpath);
+               return -1;
+       }
+
+       if (mount(rootfs->path, mpath, "none", MS_BIND|MS_REC, NULL)) {
+               SYSERROR("failed to mount '%s'->'%s'", rootfs->path, mpath);
                return -1;
        }
 
-       DEBUG("mounted '%s' on '%s'", rootfs->path, tmpfs);
+       DEBUG("mounted '%s' on '%s'", rootfs->path, mpath);
 
-       if (setup_rootfs_pivot_root(tmpfs, rootfs->pivot)) {
+       if (setup_rootfs_pivot_root(mpath, rootfs->pivot)) {
                ERROR("failed to pivot_root to '%s'", rootfs->pivot);
                return -1;
        }