]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind: fix boolean comparison 37907/head
authorLennart Poettering <lennart@poettering.net>
Thu, 19 Jun 2025 16:27:06 +0000 (18:27 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 20 Jun 2025 08:18:46 +0000 (10:18 +0200)
We cannot compare a boolean with a bit mask. This worked only by
accident, since MANAGER_IS_INHIBITED_CHECK_DELAY happened to be 1. But
we need to do this properly.

Fixes: #35565
src/login/logind-inhibit.c

index 4614609e8a02bd6d8b288990cc1acab049936b6f..2ef15588f289db8fdd403b319d74fe93aeeb2e66 100644 (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;