Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143241035
D40346.id123280.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D40346.id123280.diff
View Options
diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c
--- a/lib/libutil/login_class.c
+++ b/lib/libutil/login_class.c
@@ -391,45 +391,50 @@
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) {
- /*
- * Make it unlikely that someone would input our default sentinel
- * (which indicates no specification).
- */
- rlim_t const def_val = INT64_MIN + 1, err_val = INT64_MIN;
- rlim_t val = login_getcapnum(lc, "umask", def_val, err_val);
- if (val != def_val) {
- if (val < 0 || val > UINT16_MAX)
- /* We get here also on 'err_val'. */
- syslog(LOG_WARNING,
- "%s%s%sLogin class '%s': "
- "Invalid umask specification: '%s'",
- pwd ? "Login '" : "",
- pwd ? pwd->pw_name : "",
- pwd ? "': " : "",
- lc->lc_class,
- login_getcapstr(lc, "umask", "", ""));
- else {
- mode_t mode = val;
- umask(mode);
+ 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) {
+ /*
+ * Make it unlikely that someone would input our default
+ * sentinel (which indicates no specification).
+ */
+ rlim_t const def_val = INT64_MIN + 1, err_val = INT64_MIN;
+ rlim_t val = login_getcapnum(lc, "umask", def_val, err_val);
+ if (val != def_val) {
+ if (val < 0 || val > UINT16_MAX)
+ /* We get here also on 'err_val'. */
+ syslog(LOG_WARNING,
+ "%s%s%sLogin class '%s': "
+ "Invalid umask specification: '%s'",
+ pwd ? "Login '" : "",
+ pwd ? pwd->pw_name : "",
+ pwd ? "': " : "",
+ lc->lc_class,
+ login_getcapstr(lc, "umask", "", ""));
+ else {
+ mode_t mode = val;
+ umask(mode);
+ }
}
- }
}
- /* 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);
- }
+
+ /* 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);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 28, 10:59 PM (16 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28068458
Default Alt Text
D40346.id123280.diff (2 KB)
Attached To
Mode
D40346: setlogincontext(): Comply to style(9)
Attached
Detach File
Event Timeline
Log In to Comment