svn commit: r236198 - head/usr.sbin/jail
Jamie Gritton
jamie at FreeBSD.org
Mon May 28 20:44:12 UTC 2012
Author: jamie
Date: Mon May 28 20:44:11 2012
New Revision: 236198
URL: http://svn.freebsd.org/changeset/base/236198
Log:
When writing the jid via the -i flag, do it right when the jail is created,
before any commands run. /etc/rc.d/jail depends on this.
Modified:
head/usr.sbin/jail/command.c
head/usr.sbin/jail/jail.c
head/usr.sbin/jail/jailp.h
Modified: head/usr.sbin/jail/command.c
==============================================================================
--- head/usr.sbin/jail/command.c Mon May 28 19:48:37 2012 (r236197)
+++ head/usr.sbin/jail/command.c Mon May 28 20:44:11 2012 (r236198)
@@ -246,7 +246,7 @@ next_proc(int nonblock)
/*
* Run a single command for a jail, possible inside the jail.
*/
-int
+static int
run_command(struct cfjail *j)
{
const struct passwd *pwd;
@@ -290,6 +290,8 @@ run_command(struct cfjail *j)
} else {
if (create_jail(j) < 0)
return -1;
+ if (iflag)
+ printf("%d\n", j->jid);
if (verbose >= 0 && (j->name || verbose > 0))
jail_note(j, "created\n");
dep_done(j, DF_LIGHT);
Modified: head/usr.sbin/jail/jail.c
==============================================================================
--- head/usr.sbin/jail/jail.c Mon May 28 19:48:37 2012 (r236197)
+++ head/usr.sbin/jail/jail.c Mon May 28 20:44:11 2012 (r236198)
@@ -55,6 +55,7 @@ struct permspec {
};
const char *cfname;
+int iflag;
int note_remove;
int verbose;
@@ -129,7 +130,7 @@ main(int argc, char **argv)
size_t sysvallen;
unsigned op, pi;
int ch, docf, error, i, oldcl, sysval;
- int dflag, iflag, Rflag;
+ int dflag, Rflag;
char enforce_statfs[4];
#if defined(INET) || defined(INET6)
char *cs, *ncs;
@@ -139,7 +140,7 @@ main(int argc, char **argv)
#endif
op = 0;
- dflag = iflag = Rflag = 0;
+ dflag = Rflag = 0;
docf = 1;
cfname = CONF_FILE;
JidFile = NULL;
@@ -415,8 +416,6 @@ main(int argc, char **argv)
continue;
jail_create_done:
clear_persist(j);
- if (iflag)
- printf("%d\n", j->jid);
if (jfp != NULL)
print_jail(jfp, j, oldcl);
dep_done(j, 0);
Modified: head/usr.sbin/jail/jailp.h
==============================================================================
--- head/usr.sbin/jail/jailp.h Mon May 28 19:48:37 2012 (r236197)
+++ head/usr.sbin/jail/jailp.h Mon May 28 20:44:11 2012 (r236198)
@@ -227,6 +227,7 @@ extern struct cfjails cfjails;
extern struct cfjails ready;
extern struct cfjails depend;
extern const char *cfname;
+extern int iflag;
extern int note_remove;
extern int paralimit;
extern int verbose;
More information about the svn-src-head
mailing list