valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0187-journald-do-not-strip-leading-whitespace-from-messag.patch

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