Issues:
1. Whitespace-ish \r is not stripped, while it should be.
2. In journal \r is considered unprintable.
Lennart: "it is the duty of the client side to drop the trailing whitespace,
which "logger" doesn't do".
Reported-by: Ivan Babrou <ibobrik@gmail.com>
Explained-by: Lennart Poettering <lennart@poettering.net>
Reference: https://github.com/systemd/systemd/issues/3416
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
for (lines = 0; /* nothing */ ; lines++) {
buf = NULL;
sz = getline(&buf, &dummy, fp);
- if (sz == -1) {
+ if (sz == -1 ||
+ (sz = rtrim_whitespace((unsigned char *) buf)) == 0) {
free(buf);
break;
}
- if (0 < sz && buf[sz - 1] == '\n') {
- sz--;
- buf[sz] = '\0';
- }
if (lines == vectors) {
vectors *= 2;
if (IOV_MAX < vectors)
MESSAGE_ID=b8f74e14bc714bfc8040a5106dc9376a
MESSAGE=a b c 1 2 3
-
ret: 0