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