mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
logind: fix crash when shutdown is not issued from a tty
It's possible that sd_bus_creds_get_tty() fails and thus scheduled_shutdown_tty is NULL in method_schedule_shutdown(). Fix logind_wall_tty_filter() to get along with that, by showing the message on all TTYs, instead of crashing in strcmp(). https://launchpad.net/bugs/1553040
This commit is contained in:
@@ -65,7 +65,7 @@ bool logind_wall_tty_filter(const char *tty, void *userdata) {
|
||||
|
||||
assert(m);
|
||||
|
||||
if (!startswith(tty, "/dev/"))
|
||||
if (!startswith(tty, "/dev/") || !m->scheduled_shutdown_tty)
|
||||
return true;
|
||||
|
||||
return !streq(tty + 5, m->scheduled_shutdown_tty);
|
||||
|
||||
Reference in New Issue
Block a user