1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-03 05:18:09 +03:00

capability-util: introduce capability_is_set() helper

This commit is contained in:
Lennart Poettering 2024-12-17 19:01:13 +01:00
parent 1184626a26
commit a5370d35d6

View File

@ -69,12 +69,16 @@ assert_cc(CAP_LAST_CAP < 64);
#define CAPABILITY_QUINTET_NULL { CAP_MASK_UNSET, CAP_MASK_UNSET, CAP_MASK_UNSET, CAP_MASK_UNSET, CAP_MASK_UNSET } #define CAPABILITY_QUINTET_NULL { CAP_MASK_UNSET, CAP_MASK_UNSET, CAP_MASK_UNSET, CAP_MASK_UNSET, CAP_MASK_UNSET }
static inline bool capability_is_set(uint64_t v) {
return v != CAP_MASK_UNSET;
}
static inline bool capability_quintet_is_set(const CapabilityQuintet *q) { static inline bool capability_quintet_is_set(const CapabilityQuintet *q) {
return q->effective != CAP_MASK_UNSET || return capability_is_set(q->effective) ||
q->bounding != CAP_MASK_UNSET || capability_is_set(q->bounding) ||
q->inheritable != CAP_MASK_UNSET || capability_is_set(q->inheritable) ||
q->permitted != CAP_MASK_UNSET || capability_is_set(q->permitted) ||
q->ambient != CAP_MASK_UNSET; capability_is_set(q->ambient);
} }
/* Mangles the specified caps quintet taking the current bounding set into account: /* Mangles the specified caps quintet taking the current bounding set into account: