chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
eeaafdd
)
selinux: minor error handling fix
author
Lennart Poettering
<lennart@poettering.net>
Thu, 5 Aug 2010 17:47:41 +0000
(19:47 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Thu, 5 Aug 2010 17:50:03 +0000
(19:50 +0200)
src/util.c
patch
|
blob
|
history
diff --git
a/src/util.c
b/src/util.c
index ec5c7ca91aacbb19c807015c402fc5baed38cba1..ee7749be5ef9c4751acdb4bc3ffcf8de64890dd7 100644
(file)
--- a/
src/util.c
+++ b/
src/util.c
@@
-62,11
+62,11
@@
static struct selabel_handle *label_hnd = NULL;
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;
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;
}
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;
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);
}
if ((sclass = string_to_security_class(class)) != 0)
r = security_compute_create((security_context_t) label, dir_con, sclass, fcon);
}