aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOlivier Certner <olce.freebsd@certner.fr>2023-05-25 14:29:22 +0000
committerOlivier Certner <olce@FreeBSD.org>2024-01-29 21:58:07 +0000
commit771d5c93ab5a3fb1701d9706df2ce87d6a9da6f3 (patch)
treed1b39becb983d6b3ce7a2a41b34a5091f7babb30 /lib
parentea9bd448102b938ccb8d4b484684a6ba2d934931 (diff)
Diffstat (limited to 'lib')
-rw-r--r--lib/libutil/login_class.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c
index 933d9bc4fe1f..ee0cec3423f5 100644
--- a/lib/libutil/login_class.c
+++ b/lib/libutil/login_class.c
@@ -430,23 +430,28 @@ setclassumask(login_cap_t *lc, const struct passwd *pwd)
static void
setlogincontext(login_cap_t *lc, const struct passwd *pwd, unsigned long flags)
{
- if (lc) {
- /* Set resources */
- if (flags & LOGIN_SETRESOURCES)
- setclassresources(lc);
- /* See if there's a umask override */
- if (flags & LOGIN_SETUMASK)
- setclassumask(lc, pwd);
- /* Set paths */
- if (flags & LOGIN_SETPATH)
- setclassenvironment(lc, pwd, 1);
- /* Set environment */
- if (flags & LOGIN_SETENV)
- setclassenvironment(lc, pwd, 0);
- /* Set cpu affinity */
- if (flags & LOGIN_SETCPUMASK)
- setclasscpumask(lc);
- }
+ if (lc == NULL)
+ return;
+
+ /* Set resources. */
+ if ((flags & LOGIN_SETRESOURCES) != 0)
+ setclassresources(lc);
+
+ /* See if there's a umask override. */
+ if ((flags & LOGIN_SETUMASK) != 0)
+ setclassumask(lc, pwd);
+
+ /* Set paths. */
+ if ((flags & LOGIN_SETPATH) != 0)
+ setclassenvironment(lc, pwd, 1);
+
+ /* Set environment. */
+ if ((flags & LOGIN_SETENV) != 0)
+ setclassenvironment(lc, pwd, 0);
+
+ /* Set cpu affinity. */
+ if ((flags & LOGIN_SETCPUMASK) != 0)
+ setclasscpumask(lc);
}