From 8fc02a8cfd3da1a0f967b429ad40f90e842819e3 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Tue, 21 Oct 2025 09:43:22 +0200 Subject: [PATCH] logind-dbus: avoid assertion on HandlePowerKey=factory-reset The factory-reset action is handled together with the various sleep/shutdown actions, but its not either one. Fixes #39385 --- src/login/logind-dbus.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 7211dad9baa..6adcc789b78 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) -- 2.47.3