diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2022-05-27 13:47:23 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-06-01 09:30:07 +0200 |
commit | ea74f39c24344eafc238d1c69155bd5aca5f2e08 (patch) | |
tree | 5e0127c3c47ef776beb293338647162d1308bb67 /src/login/logind-utmp.c | |
parent | 51a2b575d751c257f2603f12fe9bb883014c37c1 (diff) | |
download | systemd-ea74f39c24344eafc238d1c69155bd5aca5f2e08.tar.gz |
login: do not issue wall messages on local terminals for suspend and hibernate
Fixes: #23520
[zjs: I added the comment and tweaked the patch a bit.
The call to reset_scheduled_shutdown() is moved down a bit to allow the
callback to have access to information about the operation being cancelled.
This all happens within the same function, so there should be no observable
change in behaviour.]
Diffstat (limited to 'src/login/logind-utmp.c')
-rw-r--r-- | src/login/logind-utmp.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/login/logind-utmp.c b/src/login/logind-utmp.c index 138c01e9b2..7d761a0d67 100644 --- a/src/login/logind-utmp.c +++ b/src/login/logind-utmp.c @@ -45,12 +45,22 @@ _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 = ASSERT_PTR(userdata); + assert(m->scheduled_shutdown_action); + const char *p = path_startswith(tty, "/dev/"); if (!p) return true; - /* Do not write to local pseudo-terminals */ - if (startswith(p, "pts/") && is_local) + /* Do not send information about events which do not destroy local sessions to local terminals. We + * can assume that if the system enters sleep or hibernation, this will be visible in an obvious way + * for any local user. And once the systems exits sleep or hibernation, the notication would be just + * noise, in particular for auto-suspend. */ + if (is_local && + IN_SET(m->scheduled_shutdown_action->handle, + HANDLE_SUSPEND, + HANDLE_HIBERNATE, + HANDLE_HYBRID_SLEEP, + HANDLE_SUSPEND_THEN_HIBERNATE)) return false; return !streq_ptr(p, m->scheduled_shutdown_tty); |