summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-08-05 19:47:41 +0200
committerLennart Poettering <lennart@poettering.net>2010-08-05 19:50:03 +0200
commit95978cf8a66b0d03271f7da2399a3b588db0c71d (patch)
tree5637225e2204690c925d2b051aeca41393469126 /src/util.c
parenteeaafddcb5ce492f2b3d53678820d41a04ab66b2 (diff)
selinux: minor error handling fix
Diffstat (limited to 'src/util.c')
-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);
}