ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
9fc0f6
From 7f85c4184fc45c3dd2c76b4867ab252c3530f84d Mon Sep 17 00:00:00 2001
9fc0f6
From: Michal Sekletar <msekleta@redhat.com>
9fc0f6
Date: Fri, 25 Jul 2014 14:38:22 +0200
9fc0f6
Subject: [PATCH] journald: always add syslog facility for messages coming from
9fc0f6
 kmsg
9fc0f6
9fc0f6
Set SYSLOG_FACILITY field for kernel log messages too. Setting only
9fc0f6
SYSLOG_IDENTIFIER="kernel" is not sufficient and tools reading journal
9fc0f6
maybe confused by missing SYSLOG_FACILITY field for kernel log messages.
9fc0f6
9fc0f6
(cherry picked from commit 36dd072cdf03dcac0fcd2d6b42f261444dc7ac88)
9fc0f6
9fc0f6
Resolves: #1113215
9fc0f6
---
9fc0f6
 src/journal/journald-kmsg.c | 6 +++---
9fc0f6
 1 file changed, 3 insertions(+), 3 deletions(-)
9fc0f6
9fc0f6
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
9fc0f6
index 9895808..e393cb7 100644
9fc0f6
--- a/src/journal/journald-kmsg.c
9fc0f6
+++ b/src/journal/journald-kmsg.c
9fc0f6
@@ -274,6 +274,9 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) {
9fc0f6
         if (asprintf(&syslog_priority, "PRIORITY=%i", priority & LOG_PRIMASK) >= 0)
9fc0f6
                 IOVEC_SET_STRING(iovec[n++], syslog_priority);
9fc0f6
 
9fc0f6
+        if (asprintf(&syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority)) >= 0)
9fc0f6
+                IOVEC_SET_STRING(iovec[n++], syslog_facility);
9fc0f6
+
9fc0f6
         if ((priority & LOG_FACMASK) == LOG_KERN)
9fc0f6
                 IOVEC_SET_STRING(iovec[n++], "SYSLOG_IDENTIFIER=kernel");
9fc0f6
         else {
9fc0f6
@@ -295,9 +298,6 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) {
9fc0f6
                         if (syslog_pid)
9fc0f6
                                 IOVEC_SET_STRING(iovec[n++], syslog_pid);
9fc0f6
                 }
9fc0f6
-
9fc0f6
-                if (asprintf(&syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority)) >= 0)
9fc0f6
-                        IOVEC_SET_STRING(iovec[n++], syslog_facility);
9fc0f6
         }
9fc0f6
 
9fc0f6
         message = cunescape_length_with_prefix(p, pl, "MESSAGE=");