chiark / gitweb /
journald: mention how long we needed to flush to /var in the logs
[elogind.git] / src / journal / journald-stream.c
index 9c4efec9bcd4713f83285a0088ddbab259a149bb..9ca26e26d654877869124970b386e315f49d3f62 100644 (file)
@@ -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"
@@ -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) {
@@ -381,8 +382,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 +404,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;