aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOlivier Certner <olce.freebsd@certner.fr>2023-06-21 08:53:37 +0000
committerOlivier Certner <olce@FreeBSD.org>2024-01-29 21:58:09 +0000
commitd162d7e2ad327ceada4102c5d6779f9ecd809502 (patch)
tree9413d51e6e7e1b08401ecdebdd91572f4e3c5efb /lib
parent7b94ec550ef6e7b75d608e125e9b78478197d4e7 (diff)
downloadsrc-d162d7e2ad327ceada4102c5d6779f9ecd809502.tar.gz
src-d162d7e2ad327ceada4102c5d6779f9ecd809502.zip
setclasspriority(): New possible value 'inherit'
It indicates to the login.conf machinery (setusercontext() / setclasscontext()) to leave priority alone, effectively inheriting it from the parent process. PR: 271749 Reviewed by: emaste, yuripv Approved by: emaste (mentor) MFC after: 3 days Relnotes: yes Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40690
Diffstat (limited to 'lib')
-rw-r--r--lib/libutil/login_class.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c
index d36926d70224..314ab0999320 100644
--- a/lib/libutil/login_class.c
+++ b/lib/libutil/login_class.c
@@ -462,9 +462,15 @@ static void
setclasspriority(login_cap_t * const lc, struct passwd const * const pwd)
{
const rlim_t def_val = LOGIN_DEFPRI, err_val = INT64_MIN;
- rlim_t p = login_getcapnum(lc, "priority", def_val, err_val);
+ rlim_t p;
int rc;
+ /* If value is "inherit", nothing to change. */
+ if (login_getcapenum(lc, "priority", inherit_enum) == 0)
+ return;
+
+ p = login_getcapnum(lc, "priority", def_val, err_val);
+
if (p == err_val) {
/* Invariant: 'lc' != NULL. */
syslog(LOG_WARNING,