diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-11-06 11:34:03 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-11-06 11:34:03 +0000 |
commit | cb12cb240714f2599addd4ec61ef336ab87482cd (patch) | |
tree | eb218e0c85ceb81753cb3a27535b93069d4ebb7a | |
parent | 52816302299854ba1644fce98b5d19db526e6c29 (diff) | |
download | busybox-cb12cb240714f2599addd4ec61ef336ab87482cd.tar.gz |
modprobe: fix a bug where we were entering endless loop
syslogd: strip trailing '\n' too, not only NULs
-rw-r--r-- | modutils/modprobe.c | 2 | ||||
-rw-r--r-- | sysklogd/syslogd.c | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index f7d193a05..dafbb4ecd 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -791,7 +791,7 @@ static void check_dep(char *mod, struct mod_list_t **head, struct mod_list_t **t 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; 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) 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? */ |