In case there's no CLONE_NEWNS, just chroot()
This commit is contained in:
parent
cbb64d571d
commit
3c9c63b608
13
contain.c
13
contain.c
@ -305,6 +305,19 @@ static bool containMountProc(struct nsjconf_t *nsjconf, const char *newrootdir)
|
||||
|
||||
bool containMountFS(struct nsjconf_t * nsjconf)
|
||||
{
|
||||
if (nsjconf->clone_newns == false) {
|
||||
if (chroot(nsjconf->chroot) == -1) {
|
||||
PLOG_E("chroot('%s')", nsjconf->chroot) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (chdir("/") == -1) {
|
||||
PLOG_E("chdir('/')");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *destdir = "/tmp";
|
||||
if (mount("none", destdir, "tmpfs", 0, NULL) == -1) {
|
||||
PLOG_E("mount('%s', 'tmpfs'", destdir);
|
||||
|
Loading…
Reference in New Issue
Block a user