mirror of
https://github.com/systemd/systemd.git
synced 2025-02-03 17:47:28 +03:00
logind-inhibit: introduce inhibit_what_is_valid
This commit is contained in:
parent
ddd0c2be81
commit
febe81313e
@ -411,7 +411,8 @@ bool manager_is_inhibited(
|
||||
bool inhibited = false;
|
||||
|
||||
assert(m);
|
||||
assert(w > 0 && w < _INHIBIT_WHAT_MAX);
|
||||
assert(w > 0);
|
||||
assert(w < _INHIBIT_WHAT_MAX);
|
||||
|
||||
HASHMAP_FOREACH(i, m->inhibitors) {
|
||||
if (!i->started)
|
||||
@ -457,7 +458,7 @@ const char *inhibit_what_to_string(InhibitWhat w) {
|
||||
"handle-reboot-key")+1];
|
||||
char *p;
|
||||
|
||||
if (w < 0 || w >= _INHIBIT_WHAT_MAX)
|
||||
if (!inhibit_what_is_valid(w))
|
||||
return NULL;
|
||||
|
||||
p = buffer;
|
||||
|
@ -68,6 +68,10 @@ bool inhibitor_is_orphan(Inhibitor *i);
|
||||
InhibitWhat manager_inhibit_what(Manager *m, InhibitMode mm);
|
||||
bool manager_is_inhibited(Manager *m, InhibitWhat w, InhibitMode mm, dual_timestamp *since, bool ignore_inactive, bool ignore_uid, uid_t uid, Inhibitor **offending);
|
||||
|
||||
static inline bool inhibit_what_is_valid(InhibitWhat w) {
|
||||
return w > 0 && w < _INHIBIT_WHAT_MAX;
|
||||
}
|
||||
|
||||
const char *inhibit_what_to_string(InhibitWhat k);
|
||||
int inhibit_what_from_string(const char *s);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user