diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 7211dad9ba..6adcc789b7 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -1946,6 +1946,11 @@ static int send_prepare_for(Manager *m, const HandleActionData *a, bool _active) assert(m); assert(a); + + /* Only sleep/shutdown actions emit a signal */ + if (a->inhibit_what < 0) + return 0; + assert(IN_SET(a->inhibit_what, INHIBIT_SHUTDOWN, INHIBIT_SLEEP)); /* We need to send both old and new signal for backward compatibility. The newer one allows clients @@ -2163,6 +2168,7 @@ int bus_manager_shutdown_or_sleep_now_or_later( delayed = m->inhibit_delay_max > 0 && + a->inhibit_what >= 0 && manager_is_inhibited(m, a->inhibit_what, NULL, MANAGER_IS_INHIBITED_CHECK_DELAY, UID_INVALID, NULL); if (delayed)