#include <sys/statvfs.h>
#include <fnmatch.h>
-#include <systemd/sd-id128.h>
+#include "sd-id128.h"
#include "util.h"
#include "condition.h"
#include "virt.h"
return use_ima() == !c->negate;
if (streq(c->parameter, "smack"))
return use_smack() == !c->negate;
+
return c->negate;
}
static bool condition_test_capability(Condition *c) {
+ _cleanup_fclose_ FILE *f = NULL;
cap_value_t value;
- FILE *f;
char line[LINE_MAX];
unsigned long long capabilities = -1;
}
}
- fclose(f);
-
return !!(capabilities & (1ULL << value)) == !c->negate;
}
}
bool condition_test_host(Condition *c) {
+ _cleanup_free_ char *h = NULL;
sd_id128_t x, y;
- char *h;
int r;
- bool b;
assert(c);
assert(c->parameter);
if (!h)
return c->negate;
- b = fnmatch(c->parameter, h, FNM_CASEFOLD) == 0;
- free(h);
-
- return b == !c->negate;
+ return (fnmatch(c->parameter, h, FNM_CASEFOLD) == 0) == !c->negate;
}
bool condition_test_ac_power(Condition *c) {