]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journald: do not strip leading whitespace from messages 156/head
authorFilipe Brandenburger <filbranden@google.com>
Thu, 11 Jun 2015 05:33:44 +0000 (22:33 -0700)
committerFilipe Brandenburger <filbranden@google.com>
Thu, 11 Jun 2015 05:35:26 +0000 (22:35 -0700)
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.

src/journal/journald-syslog.c

index 90b753094636a35ed6833ff8fcc6624824555398..ffba451955fd5833031ac328af44e038894bfeda 100644 (file)
@@ -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;
 }