Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Nov 2023 20:48:19 GMT
From:      Jamie Gritton <jamie@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 6000d46fc3c1 - main - Move "jail -e" out of the rest of jail(8) flow.
Message-ID:  <202311182048.3AIKmJGq051283@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jamie:

URL: https://cgit.FreeBSD.org/src/commit/?id=6000d46fc3c18c72bd09f7f4134c7293b62f3416

commit 6000d46fc3c18c72bd09f7f4134c7293b62f3416
Author:     Jamie Gritton <jamie@FreeBSD.org>
AuthorDate: 2023-11-18 20:47:50 +0000
Commit:     Jamie Gritton <jamie@FreeBSD.org>
CommitDate: 2023-11-18 20:47:50 +0000

    Move "jail -e" out of the rest of jail(8) flow.
---
 usr.sbin/jail/jail.c  | 25 ++++++++++++++-----------
 usr.sbin/jail/jailp.h |  1 -
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/usr.sbin/jail/jail.c b/usr.sbin/jail/jail.c
index 9e443c9f3f1d..fcff0d485682 100644
--- a/usr.sbin/jail/jail.c
+++ b/usr.sbin/jail/jail.c
@@ -139,7 +139,7 @@ main(int argc, char **argv)
 	size_t sysvallen;
 	unsigned op, pi;
 	int ch, docf, error, i, oldcl, sysval;
-	int dflag, Rflag;
+	int dflag, eflag, Rflag;
 #if defined(INET) || defined(INET6)
 	char *cs, *ncs;
 #endif
@@ -148,7 +148,7 @@ main(int argc, char **argv)
 #endif
 
 	op = 0;
-	dflag = Rflag = 0;
+	dflag = eflag = Rflag = 0;
 	docf = 1;
 	cfname = CONF_FILE;
 	JidFile = NULL;
@@ -162,7 +162,7 @@ main(int argc, char **argv)
 			dflag = 1;
 			break;
 		case 'e':
-			op |= JF_SHOW;
+			eflag = 1;
 			separator = optarg;
 			break;
 		case 'f':
@@ -232,7 +232,16 @@ main(int argc, char **argv)
 	argc -= optind;
 	argv += optind;
 
-	/* Find out which of the four command line styles this is. */
+	if (eflag) {
+		/* Just print list of all configured non-wildcard jails */
+		if (op || argc > 0)
+			usage();
+		load_config(cfname);
+		show_jails();
+		exit(0);
+	}
+
+	/* Find out which of the command line styles this is. */
 	oldcl = 0;
 	if (!op) {
 		/* Old-style command line with four fixed parameters */
@@ -282,13 +291,7 @@ main(int argc, char **argv)
 					    ? NULL : "false");
 			}
 		}
-	} else if (op == JF_STOP || op == JF_SHOW) {
-		/* Just print list of all configured non-wildcard jails */
-		if (op == JF_SHOW) {
-			load_config(cfname);
-			show_jails();
-			exit(0);
-		}
+	} else if (op == JF_STOP) {
 		/* Jail remove, perhaps using the config file */
 		if (!docf || argc == 0)
 			usage();
diff --git a/usr.sbin/jail/jailp.h b/usr.sbin/jail/jailp.h
index f371a92b82ec..c064da09d7a5 100644
--- a/usr.sbin/jail/jailp.h
+++ b/usr.sbin/jail/jailp.h
@@ -67,7 +67,6 @@
 #define JF_TIMEOUT	0x0200	/* A command (or process kill) timed out */
 #define JF_SLEEPQ	0x0400	/* Waiting on a command and/or timeout */
 #define JF_FROM_RUNQ	0x0800	/* Has already been on the run queue */
-#define JF_SHOW		0x1000	/* -e Exhibit list of configured jails */
 
 #define JF_OP_MASK		(JF_START | JF_SET | JF_STOP)
 #define JF_RESTART		(JF_START | JF_STOP)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202311182048.3AIKmJGq051283>