Skip to content

Commit 51a2b57

Browse files
committed
logind: do not print wall messages to local pseudoterminals
Fixes #23520. Replaces #23555. The problem started with cdf3706 and 90b1ec0 which 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.
1 parent e31355b commit 51a2b57

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/login/logind-utmp.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,17 @@ _const_ static usec_t when_wall(usec_t n, usec_t elapse) {
4343
}
4444

4545
bool logind_wall_tty_filter(const char *tty, bool is_local, void *userdata) {
46-
Manager *m = userdata;
47-
const char *p;
48-
49-
assert(m);
46+
Manager *m = ASSERT_PTR(userdata);
5047

51-
if (!m->scheduled_shutdown_tty)
52-
return true;
53-
54-
p = path_startswith(tty, "/dev/");
48+
const char *p = path_startswith(tty, "/dev/");
5549
if (!p)
5650
return true;
5751

58-
return !streq(p, m->scheduled_shutdown_tty);
52+
/* Do not write to local pseudo-terminals */
53+
if (startswith(p, "pts/") && is_local)
54+
return false;
55+
56+
return !streq_ptr(p, m->scheduled_shutdown_tty);
5957
}
6058

6159
static int warn_wall(Manager *m, usec_t n) {

0 commit comments

Comments
 (0)