summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c
index ec5c7ca91a..ee7749be5e 100644
--- a/src/util.c
+++ b/src/util.c
@@ -62,11 +62,11 @@
static struct selabel_handle *label_hnd = NULL;
-static inline int use_selinux(void) {
+static inline bool use_selinux(void) {
static int use_selinux_ind = -1;
- if (use_selinux_ind == -1)
- use_selinux_ind = (is_selinux_enabled() == 1);
+ if (use_selinux_ind < 0)
+ use_selinux_ind = is_selinux_enabled() > 0;
return use_selinux_ind;
}
@@ -84,6 +84,8 @@ static int label_get_file_label_from_path(
r = getfilecon(path, &dir_con);
if (r >= 0) {
r = -1;
+ errno = EINVAL;
+
if ((sclass = string_to_security_class(class)) != 0)
r = security_compute_create((security_context_t) label, dir_con, sclass, fcon);
}