diff options
| author | Kyle Evans <kevans@FreeBSD.org> | 2019-06-02 14:03:56 +0000 |
|---|---|---|
| committer | Kyle Evans <kevans@FreeBSD.org> | 2019-06-02 14:03:56 +0000 |
| commit | 067498ed56f6bcf15757a598db45ef374f6b946a (patch) | |
| tree | 07f13cf55a6c1b7831624f9cf34cd065aeddf096 | |
| parent | 71259635f77a7b40324c9ceab0a31b212dda2564 (diff) | |
Notes
| -rw-r--r-- | lib/libjail/jail_getid.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/libjail/jail_getid.c b/lib/libjail/jail_getid.c index f99a175fd3986..3700ff0d36cca 100644 --- a/lib/libjail/jail_getid.c +++ b/lib/libjail/jail_getid.c @@ -54,6 +54,15 @@ jail_getid(const char *name) jid = strtoul(name, &ep, 10); if (*name && !*ep) { + /* + * jid == 0 is a special case; it will not appear in the + * kernel's jail list, but naturally processes will be assigned + * to it because it is prison 0. Trivially return this one + * without a trip to the kernel, because it always exists but + * the lookup won't succeed. + */ + if (jid == 0) + return jid; jiov[0].iov_base = __DECONST(char *, "jid"); jiov[0].iov_len = sizeof("jid"); jiov[1].iov_base = &jid; |
