mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
journald: take leading spaces into account in syslog_parse_identifier
This is a kind of follow-up to e88baee88f
which should finally fix
the issue which that commit was supposed to fix.
This commit is contained in:
parent
30eddcd51b
commit
937b117137
@ -222,8 +222,9 @@ size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid)
|
||||
if (p[e] != '\0' && strchr(WHITESPACE, p[e]))
|
||||
e++;
|
||||
|
||||
l = (p - *buf) + e;
|
||||
*buf = p + e;
|
||||
return e;
|
||||
return l;
|
||||
}
|
||||
|
||||
static int syslog_skip_timestamp(const char **buf) {
|
||||
|
@ -41,6 +41,8 @@ int main(void) {
|
||||
test_syslog_parse_identifier(" ", NULL, NULL, " ", 0);
|
||||
test_syslog_parse_identifier(":", "", NULL, "", 1);
|
||||
test_syslog_parse_identifier(": ", "", NULL, " ", 2);
|
||||
test_syslog_parse_identifier(" :", "", NULL, "", 2);
|
||||
test_syslog_parse_identifier(" pidu:", "pidu", NULL, "", 8);
|
||||
test_syslog_parse_identifier("pidu:", "pidu", NULL, "", 5);
|
||||
test_syslog_parse_identifier("pidu: ", "pidu", NULL, "", 6);
|
||||
test_syslog_parse_identifier("pidu : ", NULL, NULL, "pidu : ", 0);
|
||||
|
Loading…
Reference in New Issue
Block a user