From owner-svn-src-all@freebsd.org Sun Dec 6 15:58:51 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4A234A18A3; Sun, 6 Dec 2020 15:58:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cprhq4FRBz4Tkp; Sun, 6 Dec 2020 15:58:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8059C12D8A; Sun, 6 Dec 2020 15:58:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B6FwpN6074861; Sun, 6 Dec 2020 15:58:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B6FwpKd074860; Sun, 6 Dec 2020 15:58:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202012061558.0B6FwpKd074860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 6 Dec 2020 15:58:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368388 - head/sbin/bectl X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sbin/bectl X-SVN-Commit-Revision: 368388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Dec 2020 15:58:51 -0000 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