setlogincontext(): Comply to style(9)

Remove indentation by inverting the big 'if (lc)' and using 'return'.
Use explicit binary operators to produce booleans.

Reviewed by:            emaste, kib, dchagin
Approved by:            emaste (mentor)
MFC after:              3 days
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40346
This commit is contained in:
Olivier Certner 2023-05-25 16:29:22 +02:00 committed by Olivier Certner
parent ea9bd44810
commit 771d5c93ab
No known key found for this signature in database
GPG key ID: 8CA13040971E2627

View file

@ -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);
}