From b1789442d69eb756355a53316c9dca4b74671883 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Wed, 12 May 2010 23:44:28 +0200 Subject: [PATCH] use defined rootfs mount point 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 --- src/lxc/conf.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 55eb71599..57b8c1a3c 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -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; } -- 2.47.2