Print tty stat fail message to syslog

In check_idle there is an sprintf call which copies an error message to
the global variable errmsg, after which, absolutely nothing was done
with the variable. From a piece of commented out code underneath, one
can tell that this line used to have a purpose, as it was used in a
bailout call, where it gets printed to the syslog. This call is deleted
and now the errmsg string is simply written to and then never used.

Now the line has been modified so the error message gets written to the
syslog, removing the need for the errmsg variable.
This commit is contained in:
Petar Kapris 2020-12-18 15:50:29 +01:00
parent a60ff18d3c
commit 311fe03ec8

View file

@ -869,8 +869,7 @@ void check_idle()
sprintf(path, "/dev/%s", dev); sprintf(path, "/dev/%s", dev);
if (stat(path, pstat) && chk_xsession(dev, host) != TIMEOUTD_XSESSION_LOCAL) { /* if can't get status for if (stat(path, pstat) && 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 */
sprintf(errmsg, "Can't get status of user %s's terminal (%s)\n", user, dev); syslog(LOG_ERR, "Can't get status of user %s's terminal (%s)\n", user, dev);
/* bailout(errmsg, 1); MOH: is there a reason to exit here? */
return; return;
} }
/* idle time is the lesser of: /* idle time is the lesser of: