X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fjournal%2Fjournald-stream.c;h=091f59de17c020daa3392e6a906414da2b1cb00a;hp=e98fe94b46254559813e39f86f6202ef337acaf4;hb=f92ae4968f070ef0ada61ba7cd585794fac404dd;hpb=968f319679d9069af037240d0c3bcd126181cdac diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c index e98fe94b4..091f59de1 100644 --- a/src/journal/journald-stream.c +++ b/src/journal/journald-stream.c @@ -29,6 +29,7 @@ #endif #include "socket-util.h" +#include "selinux-util.h" #include "journald-server.h" #include "journald-stream.h" #include "journald-syslog.h" @@ -90,7 +91,7 @@ static int stdout_stream_log(StdoutStream *s, const char *p) { priority = s->priority; if (s->level_prefix) - syslog_parse_priority((char**) &p, &priority); + syslog_parse_priority((char**) &p, &priority, false); if (s->forward_to_syslog || s->server->forward_to_syslog) server_forward_syslog(s->server, syslog_fixup_facility(priority), s->identifier, p, &s->ucred, NULL); @@ -323,7 +324,7 @@ void stdout_stream_free(StdoutStream *s) { if (s->server) { assert(s->server->n_stdout_streams > 0); s->server->n_stdout_streams --; - LIST_REMOVE(StdoutStream, stdout_stream, s->server->stdout_streams, s); + LIST_REMOVE(stdout_stream, s->server->stdout_streams, s); } if (s->fd >= 0) { @@ -339,6 +340,7 @@ void stdout_stream_free(StdoutStream *s) { #endif free(s->identifier); + free(s->unit_id); free(s); } @@ -381,8 +383,10 @@ int stdout_stream_new(Server *s) { } #ifdef HAVE_SELINUX - if (getpeercon(fd, &stream->security_context) < 0 && errno != ENOPROTOOPT) - log_error("Failed to determine peer security context: %m"); + if (use_selinux()) { + if (getpeercon(fd, &stream->security_context) < 0 && errno != ENOPROTOOPT) + log_error("Failed to determine peer security context: %m"); + } #endif if (shutdown(fd, SHUT_WR) < 0) { @@ -401,7 +405,7 @@ int stdout_stream_new(Server *s) { } stream->server = s; - LIST_PREPEND(StdoutStream, stdout_stream, s->stdout_streams, stream); + LIST_PREPEND(stdout_stream, s->stdout_streams, stream); s->n_stdout_streams ++; return 0;