diff options
author | Filipe Brandenburger <filbranden@google.com> | 2015-06-10 22:33:44 -0700 |
---|---|---|
committer | Filipe Brandenburger <filbranden@google.com> | 2015-06-10 22:35:26 -0700 |
commit | ec5ff4445cca6a1d786b8da36cf6fe0acc0b94c8 (patch) | |
tree | acda2f2ddb8343701b473c2234512d3b657a9e33 /src | |
parent | 37c47e5e5b8e47dd886ed6e8355b1203082b4a3e (diff) |
journald: do not strip leading whitespace from messages
Keep leading whitespace for compatibility with older syslog
implementations. Also useful when piping formatted output to the
`logger` command. Keep removing trailing whitespace.
Tested with `pstree | logger` and checking that the output of
`journalctl | tail` included aligned and formatted output.
Confirmed that all test cases still pass as expected.
Diffstat (limited to 'src')
-rw-r--r-- | src/journal/journald-syslog.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c index 90b7530946..ffba451955 100644 --- a/src/journal/journald-syslog.c +++ b/src/journal/journald-syslog.c @@ -234,7 +234,8 @@ size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid) if (t) *identifier = t; - e += strspn(p + e, WHITESPACE); + if (strchr(WHITESPACE, p[e])) + e++; *buf = p + e; return e; } |