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

@ -74,8 +74,8 @@
char *limit_names[] = { "idle", "session", "daily", "nologin" };
char *daynames[] = { "SU", "MO", "TU", "WE", "TH", "FR", "SA", "WK", "AL", NULL };
char daynums[] = { 1, 2, 4, 8, 16, 32, 64, 62, 127, 0 };
char *daynames[] = {"SU", "MO", "TU", "WE", "TH", "FR", "SA", "WK", "AL", NULL};
char daynums[] = { 1 , 2 , 4 , 8 , 16 , 32 , 64 , 62 , 127, 0};
struct utmp *utmpp; /* pointer to utmp file entry */
struct utmp *getutent(); /* returns next utmp file entry */
@ -812,8 +812,9 @@ int session;
return ALLOWED;
}
/* Check for exceeded time limits & logoff exceeders */
void check_idle()
{ /* Check for exceeded time limits & logoff exceeders */
{
char user[sizeof(utmpp->ut_user) + 1];
char host[sizeof(utmpp->ut_host) + 1];
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 */
return; /* skip the utmp entry */
strncpy(user, utmpp->ut_user, sizeof(user) - 1); /* get user name */
user[sizeof(user) - 1] = '\0'; /* null terminate user name string */
strncpy(host, utmpp->ut_host, sizeof(host) - 1); /* get host name */
host[sizeof(host) - 1] = '\0';
strncpy(dev, utmpp->ut_line, sizeof(dev) - 1); /* get device name */
dev[sizeof(dev) - 1] = '\0';
sprintf(path, "/dev/%s", dev);
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 */