From 25689bbf9c04ed59dfabe4e48baf4dee20dbb01e Mon Sep 17 00:00:00 2001 From: dlezcano Date: Wed, 3 Sep 2008 16:38:58 +0000 Subject: [PATCH] Add bind option for mounting setup --- src/liblxc/lxc_conf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/liblxc/lxc_conf.c b/src/liblxc/lxc_conf.c index b1681cbdb..beea5cb42 100644 --- a/src/liblxc/lxc_conf.c +++ b/src/liblxc/lxc_conf.c @@ -606,6 +606,7 @@ static int setup_mount(const char *name) struct mntent *mntent; FILE *file; int ret = -1; + unsigned long mntflags = 0; snprintf(path, MAXPATHLEN, LXCPATH "/%s/fstab", name); @@ -618,8 +619,12 @@ static int setup_mount(const char *name) } while((mntent = getmntent(file))) { + + if (hasmntopt(mntent, "bind")) + mntflags |= MS_BIND; + if (mount(mntent->mnt_fsname, mntent->mnt_dir, - mntent->mnt_type, 0, NULL)) { + mntent->mnt_type, mntflags, NULL)) { lxc_log_syserror("failed to mount '%s' on '%s'", mntent->mnt_fsname, mntent->mnt_dir); goto out;