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@xxxxxxxxx> Explained-by: Lennart Poettering <lennart@xxxxxxxxxxxxxx> Reference: https://github.com/systemd/systemd/issues/3416 Signed-off-by: Sami Kerola <kerolasa@xxxxxx> --- misc-utils/logger.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/misc-utils/logger.c b/misc-utils/logger.c index 9f2940c..6251f96 100644 --- a/misc-utils/logger.c +++ b/misc-utils/logger.c @@ -341,14 +341,10 @@ static int journald_entry(struct logger_ctl *ctl, FILE *fp) for (lines = 0; /* nothing */ ; lines++) { buf = NULL; sz = getline(&buf, &dummy, fp); - if (sz == -1) { + if (sz == -1 && (sz = rtrim_whitespace(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) -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html