svn commit: trunk/busybox: modutils sysklogd
vda at busybox.net
vda at busybox.net
Tue Nov 6 03:34:04 PST 2007
Author: vda
Date: 2007-11-06 03:34:03 -0800 (Tue, 06 Nov 2007)
New Revision: 20376
Log:
modprobe: fix a bug where we were entering endless loop
syslogd: strip trailing '\n' too, not only NULs
Modified:
trunk/busybox/modutils/modprobe.c
trunk/busybox/sysklogd/syslogd.c
Changeset:
Modified: trunk/busybox/modutils/modprobe.c
===================================================================
--- trunk/busybox/modutils/modprobe.c 2007-11-06 05:26:51 UTC (rev 20375)
+++ trunk/busybox/modutils/modprobe.c 2007-11-06 11:34:03 UTC (rev 20376)
@@ -791,7 +791,7 @@
if (*tail)
(*tail)->m_next = find;
find->m_prev = *tail;
- /*find->m_next = NULL; - xzalloc did it */
+ find->m_next = NULL; /* possibly NOT done by xzalloc! */
if (!*head)
*head = find;
Modified: trunk/busybox/sysklogd/syslogd.c
===================================================================
--- trunk/busybox/sysklogd/syslogd.c 2007-11-06 05:26:51 UTC (rev 20375)
+++ trunk/busybox/sysklogd/syslogd.c 2007-11-06 11:34:03 UTC (rev 20376)
@@ -536,10 +536,20 @@
while (1) {
if (sz == 0)
goto read_again;
- if (G.recvbuf[sz-1])
+ /* man 3 syslog says: "A trailing newline is added when needed".
+ * However, neither glibc nor uclibc do this:
+ * syslog(prio, "test") sends "test\0" to /dev/log,
+ * syslog(prio, "test\n") sends "test\n\0",
+ * IOW: newline is passed verbatim!
+ * I take it to mean that it's syslogd's job
+ * to make those look identical in the log files */
+ if (G.recvbuf[sz-1] && G.recvbuf[sz-1] != '\n')
break;
sz--;
}
+ /* Maybe we need to add '\n' here, not later?
+ * It looks like stock syslogd does send '\n' over network,
+ * but we do not (see sendto below) */
G.recvbuf[sz] = '\0'; /* make sure it *is* NUL terminated */
/* TODO: maybe suppress duplicates? */
More information about the busybox-cvs
mailing list