logind: ensure the stronger inhibitor currently in place is taken into account
This commit is contained in:
@@ -404,9 +404,9 @@ bool manager_is_inhibited(
|
||||
bool ignore_inactive,
|
||||
bool ignore_uid,
|
||||
uid_t uid,
|
||||
Inhibitor **offending) {
|
||||
Inhibitor **ret_offending) {
|
||||
|
||||
Inhibitor *i;
|
||||
Inhibitor *i, *offending = NULL;
|
||||
struct dual_timestamp ts = DUAL_TIMESTAMP_NULL;
|
||||
bool inhibited = false;
|
||||
|
||||
@@ -437,13 +437,17 @@ bool manager_is_inhibited(
|
||||
|
||||
inhibited = true;
|
||||
|
||||
if (offending)
|
||||
*offending = i;
|
||||
/* Stronger inhibitor wins */
|
||||
if (!offending || (i->mode < offending->mode))
|
||||
offending = i;
|
||||
}
|
||||
|
||||
if (since)
|
||||
*since = ts;
|
||||
|
||||
if (ret_offending)
|
||||
*ret_offending = offending;
|
||||
|
||||
return inhibited;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user