aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2020-12-15 21:53:54 +0000
committerKyle Evans <kevans@FreeBSD.org>2020-12-15 21:53:54 +0000
commitca8c198afa5450fe25e6e9ab56fa195d74953baa (patch)
treeb87b7cf0c668d9dad31436109855cb190403fb99
parent21d35411c119c694f333b979334ae119852caa49 (diff)
downloadsrc-ca8c198afa5450fe25e6e9ab56fa195d74953baa.tar.gz
src-ca8c198afa5450fe25e6e9ab56fa195d74953baa.zip
MFC r368388: bectl: simplify the tail end of the jail cmd
This has already confused me once (and I'm pretty sure I wrote it), so let's clarify: unjailing after the command has completed will only happen if we're interactive and -U has not been specified. This just folds two conditionals together to make it obvious how -b/-U interact with each other.
Notes
Notes: svn path=/stable/12/; revision=368682
-rw-r--r--sbin/bectl/bectl_jail.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sbin/bectl/bectl_jail.c b/sbin/bectl/bectl_jail.c
index c01c4ebabd36..1d7d4a1496a2 100644
--- a/sbin/bectl/bectl_jail.c
+++ b/sbin/bectl/bectl_jail.c
@@ -356,10 +356,8 @@ bectl_cmd_jail(int argc, char *argv[])
}
free(jargv);
- if (!interactive)
- return (0);
-
- if (unjail) {
+ /* Non-interactive (-b) mode means the jail sticks around. */
+ if (interactive && unjail) {
/*
* We're not checking the jail id result here because in the
* case of invalid param, or last command in jail was an error