X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fjournald-kmsg.c;h=9935986c121ac242fc1aaa6faaa92160fa1bbe83;hb=5cb36f41f01cf4b1f4395abfffd1b33116591e58;hp=35948ea754c4e510509f401c27d6c5a6184e2016;hpb=03e334a1c7dc8c20c38902aa039440763acc9b17;p=elogind.git diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c index 35948ea75..9935986c1 100644 --- a/src/journal/journald-kmsg.c +++ b/src/journal/journald-kmsg.c @@ -25,7 +25,7 @@ #include #include -#include +#include "systemd/sd-messages.h" #include #include "journald-server.h" @@ -71,7 +71,7 @@ void server_forward_kmsg( identifier = ident_buf; } - snprintf(header_pid, sizeof(header_pid), "[%lu]: ", (unsigned long) ucred->pid); + snprintf(header_pid, sizeof(header_pid), "["PID_FMT"]: ", ucred->pid); char_array_0(header_pid); if (identifier) @@ -274,6 +274,9 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) { if (asprintf(&syslog_priority, "PRIORITY=%i", priority & LOG_PRIMASK) >= 0) IOVEC_SET_STRING(iovec[n++], syslog_priority); + if (asprintf(&syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority)) >= 0) + IOVEC_SET_STRING(iovec[n++], syslog_facility); + if ((priority & LOG_FACMASK) == LOG_KERN) IOVEC_SET_STRING(iovec[n++], "SYSLOG_IDENTIFIER=kernel"); else { @@ -295,9 +298,6 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) { if (syslog_pid) IOVEC_SET_STRING(iovec[n++], syslog_pid); } - - if (asprintf(&syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority)) >= 0) - IOVEC_SET_STRING(iovec[n++], syslog_facility); } message = cunescape_length_with_prefix(p, pl, "MESSAGE=");