Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Dec 2020 15:58:51 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r368388 - head/sbin/bectl
Message-ID:  <202012061558.0B6FwpKd074860@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Sun Dec  6 15:58:50 2020
New Revision: 368388
URL: https://svnweb.freebsd.org/changeset/base/368388

Log:
  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.
  
  MFC after:	3 days

Modified:
  head/sbin/bectl/bectl_jail.c

Modified: head/sbin/bectl/bectl_jail.c
==============================================================================
--- head/sbin/bectl/bectl_jail.c	Sun Dec  6 11:49:21 2020	(r368387)
+++ head/sbin/bectl/bectl_jail.c	Sun Dec  6 15:58:50 2020	(r368388)
@@ -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



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