aboutsummaryrefslogtreecommitdiff
path: root/sysklogd
diff options
context:
space:
mode:
Diffstat (limited to 'sysklogd')
-rw-r--r--sysklogd/syslogd.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 2bf5b5c80..da63ced42 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -536,10 +536,20 @@ static void do_syslogd(void)
536 while (1) { 536 while (1) {
537 if (sz == 0) 537 if (sz == 0)
538 goto read_again; 538 goto read_again;
539 if (G.recvbuf[sz-1]) 539 /* man 3 syslog says: "A trailing newline is added when needed".
540 * However, neither glibc nor uclibc do this:
541 * syslog(prio, "test") sends "test\0" to /dev/log,
542 * syslog(prio, "test\n") sends "test\n\0",
543 * IOW: newline is passed verbatim!
544 * I take it to mean that it's syslogd's job
545 * to make those look identical in the log files */
546 if (G.recvbuf[sz-1] && G.recvbuf[sz-1] != '\n')
540 break; 547 break;
541 sz--; 548 sz--;
542 } 549 }
550 /* Maybe we need to add '\n' here, not later?
551 * It looks like stock syslogd does send '\n' over network,
552 * but we do not (see sendto below) */
543 G.recvbuf[sz] = '\0'; /* make sure it *is* NUL terminated */ 553 G.recvbuf[sz] = '\0'; /* make sure it *is* NUL terminated */
544 554
545 /* TODO: maybe suppress duplicates? */ 555 /* TODO: maybe suppress duplicates? */