diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-08-05 13:40:16 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-08-05 19:50:02 +0200 |
commit | 6319292f15478f763777738c9a98faa99ae819c1 (patch) | |
tree | 6c697206e807105da37632f3540bd11d9e7b0e29 /src/util.c | |
parent | 7d49c54770b16c54fcad41860535b592cce3570a (diff) |
selinux: fix labels only when configured for it
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/util.c b/src/util.c index 39dca0d458..ec5c7ca91a 100644 --- a/src/util.c +++ b/src/util.c @@ -122,7 +122,7 @@ int label_fix(const char *path) { struct stat st; security_context_t fcon; - if (!use_selinux()) + if (!use_selinux() || !label_hnd) return 0; r = lstat(path, &st); @@ -147,7 +147,7 @@ int label_fix(const char *path) { void label_finish(void) { #ifdef HAVE_SELINUX - if (use_selinux()) + if (use_selinux() && label_hnd) selabel_close(label_hnd); #endif } @@ -270,7 +270,7 @@ static int label_mkdir( int r; security_context_t fcon = NULL; - if (use_selinux()) { + if (use_selinux() && label_hnd) { if (path[0] == '/') { r = selabel_lookup_raw(label_hnd, &fcon, path, mode); } @@ -300,7 +300,7 @@ static int label_mkdir( r = mkdir(path, mode); finish: - if (use_selinux()) { + if (use_selinux() && label_hnd) { setfscreatecon(NULL); freecon(fcon); } |