From 95978cf8a66b0d03271f7da2399a3b588db0c71d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 5 Aug 2010 19:47:41 +0200 Subject: [PATCH] selinux: minor error handling fix --- src/util.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/util.c b/src/util.c index ec5c7ca9..ee7749be 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); } -- 2.39.5