diff --git a/lib/misc/selinux.c b/lib/misc/selinux.c index 93f5357c0..5bc3d7e48 100644 --- a/lib/misc/selinux.c +++ b/lib/misc/selinux.c @@ -22,7 +22,6 @@ int set_selinux_context(const char *path) { security_context_t scontext; - log_very_verbose("Setting SELinux context for %s", path); if (is_selinux_enabled() <= 0) return 1; @@ -31,6 +30,9 @@ int set_selinux_context(const char *path) return 0; } + log_very_verbose("Setting SELinux context for %s to %s", + path, scontext); + if ((lsetfilecon(path, scontext) < 0) && (errno != ENOTSUP)) { log_sys_error("lsetfilecon", path); free(scontext); diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c index 42f8d03d6..7f50fa255 100644 --- a/libdm/libdm-common.c +++ b/libdm/libdm-common.c @@ -204,7 +204,6 @@ int set_selinux_context(const char *path) { security_context_t scontext; - log_debug("Setting SELinux context for %s", path); if (is_selinux_enabled() <= 0) return 1; @@ -213,6 +212,8 @@ int set_selinux_context(const char *path) return 0; } + log_debug("Setting SELinux context for %s to %s", path, scontext); + if ((lsetfilecon(path, scontext) < 0) && (errno != ENOTSUP)) { log_error("%s: lsetfilecon failed: %s", path, strerror(errno)); free(scontext);