summaryrefslogtreecommitdiff
path: root/src/journal/journald-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/journal/journald-server.c')
-rw-r--r--src/journal/journald-server.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index e03e413aef..9732e1b25e 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -629,19 +629,21 @@ static void dispatch_message_real(
}
#ifdef HAVE_SELINUX
- if (label) {
- x = alloca(sizeof("_SELINUX_CONTEXT=") + label_len);
+ if (use_selinux()) {
+ if (label) {
+ x = alloca(sizeof("_SELINUX_CONTEXT=") + label_len);
- *((char*) mempcpy(stpcpy(x, "_SELINUX_CONTEXT="), label, label_len)) = 0;
- IOVEC_SET_STRING(iovec[n++], x);
- } else {
- security_context_t con;
+ *((char*) mempcpy(stpcpy(x, "_SELINUX_CONTEXT="), label, label_len)) = 0;
+ IOVEC_SET_STRING(iovec[n++], x);
+ } else {
+ security_context_t con;
- if (getpidcon(ucred->pid, &con) >= 0) {
- x = strappenda("_SELINUX_CONTEXT=", con);
+ if (getpidcon(ucred->pid, &con) >= 0) {
+ x = strappenda("_SELINUX_CONTEXT=", con);
- freecon(con);
- IOVEC_SET_STRING(iovec[n++], x);
+ freecon(con);
+ IOVEC_SET_STRING(iovec[n++], x);
+ }
}
}
#endif