Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jun 2019 14:05: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: r348510 - head/sbin/bectl
Message-ID:  <201906021405.x52E5plg067822@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Sun Jun  2 14:05:51 2019
New Revision: 348510
URL: https://svnweb.freebsd.org/changeset/base/348510

Log:
  bectl(8): Don't accept jid=0 from jail_getid
  
  This will trivially exist, but we don't want it - none of our jailed BEs
  will have jid=0.
  
  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 Jun  2 14:03:56 2019	(r348509)
+++ head/sbin/bectl/bectl_jail.c	Sun Jun  2 14:05:51 2019	(r348510)
@@ -411,7 +411,12 @@ bectl_locate_jail(const char *ident)
 
 	/* Try the easy-match first */
 	jid = jail_getid(ident);
-	if (jid != -1)
+	/*
+	 * jail_getid(0) will always return 0, because this prison does exist.
+	 * bectl(8) knows that this is not what it wants, so we should fall
+	 * back to mount point search.
+	 */
+	if (jid > 0)
 		return (jid);
 
 	/* Attempt to try it as a BE name, first */



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