logind: do not print wall messages to local pseudoterminals
Fixes #23520. Replaces #23555. The problem started withcdf370626fand90b1ec03b2which together started printing the wall message in more cases. The motivation for those change was reasonable, but this clearly causes problems described in #23520: users are getting unexpected wall messages. Xterm, urxvt, (anything using libutempter?), and tmux (in some configurations), register local pty sessions in utmp. So let's try to suppress the message for local pseudo-terminal logins. This patch based on #23538, but instead of filtering just on /dev/pts, it uses the .ut_addr_v6 to only filter out local entries.
This commit is contained in:
@@ -43,19 +43,17 @@ _const_ static usec_t when_wall(usec_t n, usec_t elapse) {
|
||||
}
|
||||
|
||||
bool logind_wall_tty_filter(const char *tty, bool is_local, void *userdata) {
|
||||
Manager *m = userdata;
|
||||
const char *p;
|
||||
Manager *m = ASSERT_PTR(userdata);
|
||||
|
||||
assert(m);
|
||||
|
||||
if (!m->scheduled_shutdown_tty)
|
||||
return true;
|
||||
|
||||
p = path_startswith(tty, "/dev/");
|
||||
const char *p = path_startswith(tty, "/dev/");
|
||||
if (!p)
|
||||
return true;
|
||||
|
||||
return !streq(p, m->scheduled_shutdown_tty);
|
||||
/* Do not write to local pseudo-terminals */
|
||||
if (startswith(p, "pts/") && is_local)
|
||||
return false;
|
||||
|
||||
return !streq_ptr(p, m->scheduled_shutdown_tty);
|
||||
}
|
||||
|
||||
static int warn_wall(Manager *m, usec_t n) {
|
||||
|
||||
Reference in New Issue
Block a user