Add minor stylistic changes

This commit is contained in:
Petar Kapris 2021-01-03 20:40:51 +01:00
parent 2a47637d5e
commit 69f002acd2

View file

@ -812,8 +812,9 @@ int session;
return ALLOWED; return ALLOWED;
} }
/* Check for exceeded time limits & logoff exceeders */
void check_idle() void check_idle()
{ /* Check for exceeded time limits & logoff exceeders */ {
char user[sizeof(utmpp->ut_user) + 1]; char user[sizeof(utmpp->ut_user) + 1];
char host[sizeof(utmpp->ut_host) + 1]; char host[sizeof(utmpp->ut_host) + 1];
struct stat status; struct stat status;
@ -821,13 +822,14 @@ void check_idle()
if (utmpp->ut_type != USER_PROCESS || kill(utmpp->ut_pid, 0) == -1) /* if not user process, or if proc doesn't exist */ if (utmpp->ut_type != USER_PROCESS || kill(utmpp->ut_pid, 0) == -1) /* if not user process, or if proc doesn't exist */
return; /* skip the utmp entry */ return; /* skip the utmp entry */
strncpy(user, utmpp->ut_user, sizeof(user) - 1); /* get user name */ strncpy(user, utmpp->ut_user, sizeof(user) - 1); /* get user name */
user[sizeof(user) - 1] = '\0'; /* null terminate user name string */ user[sizeof(user) - 1] = '\0'; /* null terminate user name string */
strncpy(host, utmpp->ut_host, sizeof(host) - 1); /* get host name */ strncpy(host, utmpp->ut_host, sizeof(host) - 1); /* get host name */
host[sizeof(host) - 1] = '\0'; host[sizeof(host) - 1] = '\0';
strncpy(dev, utmpp->ut_line, sizeof(dev) - 1); /* get device name */ strncpy(dev, utmpp->ut_line, sizeof(dev) - 1); /* get device name */
dev[sizeof(dev) - 1] = '\0'; dev[sizeof(dev) - 1] = '\0';
sprintf(path, "/dev/%s", dev); sprintf(path, "/dev/%s", dev);
if (stat(path, &status) && chk_xsession(dev, host) != TIMEOUTD_XSESSION_LOCAL) { /* if can't get status for if (stat(path, &status) && chk_xsession(dev, host) != TIMEOUTD_XSESSION_LOCAL) { /* if can't get status for
port && if it's not a local Xsession */ port && if it's not a local Xsession */