ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
803fb7
From fa74ba131041161f1ae9fbc0a3b11f9a005b9d8f Mon Sep 17 00:00:00 2001
803fb7
From: Filipe Brandenburger <filbranden@google.com>
803fb7
Date: Wed, 10 Jun 2015 22:33:44 -0700
803fb7
Subject: [PATCH] journald: do not strip leading whitespace from messages
803fb7
803fb7
Keep leading whitespace for compatibility with older syslog
803fb7
implementations.  Also useful when piping formatted output to the
803fb7
`logger` command.  Keep removing trailing whitespace.
803fb7
803fb7
Tested with `pstree | logger` and checking that the output of
803fb7
`journalctl | tail` included aligned and formatted output.
803fb7
803fb7
Confirmed that all test cases still pass as expected.
803fb7
803fb7
Cherry-picked from: ec5ff444
803fb7
Resolves: #1227396
803fb7
---
803fb7
 src/journal/journald-syslog.c | 3 ++-
803fb7
 1 file changed, 2 insertions(+), 1 deletion(-)
803fb7
803fb7
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c
803fb7
index 7d545ca31..ba80941d7 100644
803fb7
--- a/src/journal/journald-syslog.c
803fb7
+++ b/src/journal/journald-syslog.c
803fb7
@@ -232,7 +232,8 @@ size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid)
803fb7
         if (t)
803fb7
                 *identifier = t;
803fb7
 
803fb7
-        e += strspn(p + e, WHITESPACE);
803fb7
+        if (strchr(WHITESPACE, p[e]))
803fb7
+                e++;
803fb7
         *buf = p + e;
803fb7
         return e;
803fb7
 }