From: David Tardon Date: Tue, 21 Oct 2025 07:43:22 +0000 (+0200) Subject: logind-dbus: avoid assertion on HandlePowerKey=factory-reset X-Git-Tag: v259-rc1~36 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8fc02a8cfd3da1a0f967b429ad40f90e842819e3;p=thirdparty%2Fsystemd.git 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 --- 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)