From 7c08a497ba5d0f65150102abe7e87ad883b77653 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Sun, 2 Jun 2019 14:05:51 +0000 Subject: [PATCH] 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 --- sbin/bectl/bectl_jail.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sbin/bectl/bectl_jail.c b/sbin/bectl/bectl_jail.c index bc808001853b..c01c4ebabd36 100644 --- a/sbin/bectl/bectl_jail.c +++ b/sbin/bectl/bectl_jail.c @@ -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 */