diff options
author | lns <matzeton@googlemail.com> | 2018-04-28 12:08:54 +0200 |
---|---|---|
committer | lns <matzeton@googlemail.com> | 2018-04-28 12:08:54 +0200 |
commit | b38788d83796f12e6bb060b11ab7b843c4340c99 (patch) | |
tree | a7d118c1f91ff34d6a35d414b7eaa370a4a5a548 /src/jail.c | |
parent | 45e0049315f9ca7e68a97fcfa73778f1c5dc1d75 (diff) |
POTD skeleton #36.
Signed-off-by: lns <matzeton@googlemail.com>
Diffstat (limited to 'src/jail.c')
-rw-r--r-- | src/jail.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -249,6 +249,7 @@ error: static int jail_childfn(void *arg) { jail_prisoner_process *args; + const char *path_dev = "/dev"; int term_fd; struct termios *term = NULL; struct winsize *win = NULL; @@ -272,6 +273,15 @@ static int jail_childfn(void *arg) exit(EXIT_FAILURE); } + D2("Mounting %s to %s%s", path_dev, args->newroot, path_dev); + if (dir_is_mountpoint(path_dev) > 0) { + W2("%s%s is already a mountpoint", args->newroot, path_dev); + } + if (mount_dev(path_dev)) { + E2("Can not mount /dev to %s%s", args->newroot, path_dev); + exit(EXIT_FAILURE); + } + D2("%s", "Forking a new pseudo terminal"); child_pid = forkpty(&term_fd, NULL, term, win); if (!child_pid) { |