diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c index 8c5a2e340a68..2c16d73d4693 100644 --- a/lib/libc/gen/syslog.c +++ b/lib/libc/gen/syslog.c @@ -222,6 +222,10 @@ vsyslog(pri, fmt, ap) cnt = sizeof(tbuf) - tbuf_cookie.left; + /* Remove a trailing newline */ + if (tbuf[cnt - 1] == '\n') + cnt--; + /* Output to stderr if requested. */ if (LogStat & LOG_PERROR) { struct iovec iov[2];