logind inhibitor code fixes (#37907)

Fixes: #35565
This commit is contained in:
Yu Watanabe
2025-06-21 02:09:52 +09:00
committed by GitHub
2 changed files with 10 additions and 10 deletions

View File

@@ -2054,17 +2054,17 @@ int manager_dispatch_delayed(Manager *manager, bool timeout) {
if (!manager->delayed_action || manager->action_job)
return 0;
if (manager_is_inhibited(manager,
manager->delayed_action->inhibit_what,
NULL,
MANAGER_IS_INHIBITED_CHECK_DELAY,
UID_INVALID,
&offending)) {
_cleanup_free_ char *comm = NULL, *u = NULL;
if (manager_is_inhibited(
manager,
manager->delayed_action->inhibit_what,
/* since= */ NULL,
MANAGER_IS_INHIBITED_CHECK_DELAY,
UID_INVALID,
&offending)) {
if (!timeout)
return 0;
_cleanup_free_ char *comm = NULL, *u = NULL;
(void) pidref_get_comm(&offending->pid, &comm);
u = uid_to_name(offending->uid);

View File

@@ -421,10 +421,10 @@ bool manager_is_inhibited(
if (!(i->what & w))
continue;
if ((flags & MANAGER_IS_INHIBITED_CHECK_DELAY) != (i->mode == INHIBIT_DELAY))
if (FLAGS_SET(flags, MANAGER_IS_INHIBITED_CHECK_DELAY) != (i->mode == INHIBIT_DELAY))
continue;
if ((flags & MANAGER_IS_INHIBITED_IGNORE_INACTIVE) &&
if (FLAGS_SET(flags, MANAGER_IS_INHIBITED_IGNORE_INACTIVE) &&
pidref_is_active_session(m, &i->pid) <= 0)
continue;