Remove a trailing newline, to behave as documented in syslog(3):

"A trailing newline is added if none is present."

The code in syslogd, stderr, and console output always adds a newline
at the EOL.  However, the existing code never actually removed a
trailing newline, and apparently relied on syslogd to convert it
into a space character.  Thus, the existing newline was converted
to a trailing space at the EOL by syslogd, while stderr, and console
output resulted in an empty line.

MFC after:	2 weeks
This commit is contained in:
dds 2004-05-10 17:12:52 +00:00
parent 5994ff7b4c
commit 9498b96a34

View File

@ -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];