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:
parent
5994ff7b4c
commit
9498b96a34
@ -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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user