summaryrefslogtreecommitdiffstats
path: root/usr.sbin/jail/jail.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-06-27 10:10:16 +0000
committerpjd <pjd@FreeBSD.org>2004-06-27 10:10:16 +0000
commitbf8b1fec3a0ce5222257be036648762be481062e (patch)
treeed1dc7f6e1c73441314ba8cee2b799da47be1836 /usr.sbin/jail/jail.c
parent32356d604915fd82194fe6d674571b7db002f1b7 (diff)
downloadFreeBSD-src-bf8b1fec3a0ce5222257be036648762be481062e.zip
FreeBSD-src-bf8b1fec3a0ce5222257be036648762be481062e.tar.gz
Prepare jail(8) utility for new functionality which will limit
seeing status of mounted file system for jailed processes. Pass full path of jail's root directory to the kernel. mount(8) utility is doing the same thing already.
Diffstat (limited to 'usr.sbin/jail/jail.c')
-rw-r--r--usr.sbin/jail/jail.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/jail/jail.c b/usr.sbin/jail/jail.c
index 1e5ff9b..ab188ee 100644
--- a/usr.sbin/jail/jail.c
+++ b/usr.sbin/jail/jail.c
@@ -52,7 +52,7 @@ main(int argc, char **argv)
struct passwd *pwd;
struct in_addr in;
int ch, groups[NGROUPS], i, iflag, ngroups, uflag, Uflag;
- char *username;
+ char path[PATH_MAX], *username;
iflag = uflag = Uflag = 0;
username = NULL;
@@ -82,11 +82,13 @@ main(int argc, char **argv)
usage();
if (uflag)
GET_USER_INFO;
- if (chdir(argv[0]) != 0)
- err(1, "chdir: %s", argv[0]);
+ if (realpath(argv[0], path) == NULL)
+ err(1, "realpath: %s", argv[0]);
+ if (chdir(path) != 0)
+ err(1, "chdir: %s", path);
memset(&j, 0, sizeof(j));
j.version = 0;
- j.path = argv[0];
+ j.path = path;
j.hostname = argv[1];
if (inet_aton(argv[2], &in) == 0)
errx(1, "Could not make sense of ip-number: %s", argv[2]);
OpenPOWER on IntegriCloud