#include "util.h"
int have_effective_cap(int value) {
- _cleanup_cap_free_ cap_t cap;
+ _cleanup_cap_free_ cap_t cap = NULL;
cap_flag_value_t fv;
cap = cap_get_proc();
combined = q->effective | q->bounding | q->inheritable | q->permitted;
- ambient_supported = q->ambient != (uint64_t) -1;
+ ambient_supported = q->ambient != UINT64_MAX;
if (ambient_supported)
combined |= q->ambient;
_cleanup_cap_free_ cap_t c = NULL, modified = NULL;
int r;
- if (q->ambient != (uint64_t) -1) {
+ if (q->ambient != UINT64_MAX) {
bool changed = false;
c = cap_get_proc();
return r;
}
- if (q->inheritable != (uint64_t) -1 || q->permitted != (uint64_t) -1 || q->effective != (uint64_t) -1) {
+ if (q->inheritable != UINT64_MAX || q->permitted != UINT64_MAX || q->effective != UINT64_MAX) {
bool changed = false;
if (!c) {
uint64_t m = UINT64_C(1) << i;
cap_value_t cv = (cap_value_t) i;
- if (q->inheritable != (uint64_t) -1) {
+ if (q->inheritable != UINT64_MAX) {
cap_flag_value_t old_value, new_value;
if (cap_get_flag(c, cv, CAP_INHERITABLE, &old_value) < 0) {
}
}
- if (q->permitted != (uint64_t) -1) {
+ if (q->permitted != UINT64_MAX) {
cap_flag_value_t old_value, new_value;
if (cap_get_flag(c, cv, CAP_PERMITTED, &old_value) < 0) {
}
}
- if (q->effective != (uint64_t) -1) {
+ if (q->effective != UINT64_MAX) {
cap_flag_value_t old_value, new_value;
if (cap_get_flag(c, cv, CAP_EFFECTIVE, &old_value) < 0) {
if (changed) {
/* In order to change the bounding caps, we need to keep CAP_SETPCAP for a bit
* longer. Let's add it to our list hence for now. */
- if (q->bounding != (uint64_t) -1) {
+ if (q->bounding != UINT64_MAX) {
cap_value_t cv = CAP_SETPCAP;
modified = cap_dup(c);
}
}
- if (q->bounding != (uint64_t) -1) {
+ if (q->bounding != UINT64_MAX) {
r = capability_bounding_set_drop(q->bounding, false);
if (r < 0)
return r;