if (r == 0)
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
- reset_scheduled_shutdown(m);
-
if (m->enable_wall_messages) {
_cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL;
_cleanup_free_ char *username = NULL;
username, tty, logind_wall_tty_filter, m);
}
+ reset_scheduled_shutdown(m);
+
return sd_bus_reply_method_return(message, "b", true);
}
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);