2
0
mirror of git://github.com/lxc/lxc synced 2025-08-31 10:49:33 +00:00

Add bind option for mounting setup

This commit is contained in:
dlezcano
2008-09-03 16:38:58 +00:00
parent 25557af8c6
commit 25689bbf9c

View File

@@ -606,6 +606,7 @@ static int setup_mount(const char *name)
struct mntent *mntent; struct mntent *mntent;
FILE *file; FILE *file;
int ret = -1; int ret = -1;
unsigned long mntflags = 0;
snprintf(path, MAXPATHLEN, LXCPATH "/%s/fstab", name); snprintf(path, MAXPATHLEN, LXCPATH "/%s/fstab", name);
@@ -618,8 +619,12 @@ static int setup_mount(const char *name)
} }
while((mntent = getmntent(file))) { while((mntent = getmntent(file))) {
if (hasmntopt(mntent, "bind"))
mntflags |= MS_BIND;
if (mount(mntent->mnt_fsname, mntent->mnt_dir, 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'", lxc_log_syserror("failed to mount '%s' on '%s'",
mntent->mnt_fsname, mntent->mnt_dir); mntent->mnt_fsname, mntent->mnt_dir);
goto out; goto out;