From 4bef00e8f39ef127ff8922d0931e7ffd95950d20 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 18 May 2004 16:23:45 +0000 Subject: Tested on FreeBSD 5.2.1. Fixed bugs. --- srcx/jstart.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'srcx/jstart.c') diff --git a/srcx/jstart.c b/srcx/jstart.c index 76bdaae..370c064 100644 --- a/srcx/jstart.c +++ b/srcx/jstart.c @@ -3,23 +3,17 @@ /* TODO: Attribute properly */ #include -#include #include -#include -#include -#include +#include + +#include +#include #include -#include #include -#include #include -#include -#include #include -#include #include -#include #include "util.h" @@ -27,9 +21,13 @@ #include "../config.h" #endif +#define START_SCRIPT "/etc/rc" +static char* START_ARGS[] = { _PATH_BSHELL, START_SCRIPT }; + +static void usage(); + int main(int argc, char* argv[]) { -#include int ch, jid; struct jail j; int printjid = 0; @@ -66,13 +64,12 @@ int main(int argc, char* argv[]) if(chdir(argv[0]) != 0) err(1, "couldn't change to jail directory: %s", argv[0]); - if(inet_aton(argv[2], &in) != 0) + if(inet_aton(argv[2], &in) != 1) errx(1, "invalid ip address: %s", argv[2]); memset(&j, 0, sizeof(j)); j.version = 0; j.path = argv[0]; -#include j.hostname = argv[1]; j.ip_number = ntohl(in.s_addr); @@ -84,7 +81,6 @@ int main(int argc, char* argv[]) if(console) { - } if(printjid) @@ -93,10 +89,10 @@ int main(int argc, char* argv[]) fflush(stdout); } - if(!check_jail_command("/etc/rc")) + if(!check_jail_command(NULL, START_SCRIPT)) exit(1); - run_jail_command("/etc/rc"); + run_jail_command(NULL, START_ARGS[0], START_ARGS, JAIL_RUN_CONSOLE | JAIL_RUN_STDOUT); return 0; } @@ -105,3 +101,5 @@ static void usage() fprintf(stderr, "usage: jstart [-ic] path hostname ip-number\n"); exit(2); } + + -- cgit v1.2.3