summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2016-03-23 08:46:58 +0100
committerMartin Pitt <martin.pitt@ubuntu.com>2016-03-24 08:35:17 +0100
commitb4944d2df248fbd2f96a4b9b4fe02fe0c1af7499 (patch)
tree65ffe42f3fd27bd4d4d4cb139cc37d36a0fa6951
parentb59f0ecd27b1c6e24a1835e31c638dcf765517e4 (diff)
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
-rw-r--r--src/login/logind-utmp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/login/logind-utmp.c b/src/login/logind-utmp.c
index 11a91c3947..29ab00eb1f 100644
--- a/src/login/logind-utmp.c
+++ b/src/login/logind-utmp.c
@@ -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);