From: Matt Kraai Date: Tue, 14 Aug 2001 18:05:40 +0000 (-0000) Subject: Backported syslogd fix. X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d85117bb8577174f33ca29f14282d3d78bd55dde;p=oweals%2Fbusybox.git Backported syslogd fix. --- diff --git a/busybox/sysklogd/syslogd.c b/busybox/sysklogd/syslogd.c index 14219eb54..25bc68f20 100644 --- a/busybox/sysklogd/syslogd.c +++ b/busybox/sysklogd/syslogd.c @@ -394,16 +394,17 @@ static int serveConnection (int conn) { RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1); int n_read; + char *p = tmpbuf; n_read = read (conn, tmpbuf, BUFSIZE ); - if (n_read > 0) { + while (p < tmpbuf + n_read) { int pri = (LOG_USER | LOG_NOTICE); char line[ BUFSIZE + 1 ]; unsigned char c; - char *p = tmpbuf, *q = line; + char *q = line; tmpbuf[ n_read - 1 ] = '\0'; @@ -428,6 +429,7 @@ static int serveConnection (int conn) p++; } *q = '\0'; + p++; /* Now log it */ logMessage (pri, line); } diff --git a/busybox/syslogd.c b/busybox/syslogd.c index 14219eb54..25bc68f20 100644 --- a/busybox/syslogd.c +++ b/busybox/syslogd.c @@ -394,16 +394,17 @@ static int serveConnection (int conn) { RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1); int n_read; + char *p = tmpbuf; n_read = read (conn, tmpbuf, BUFSIZE ); - if (n_read > 0) { + while (p < tmpbuf + n_read) { int pri = (LOG_USER | LOG_NOTICE); char line[ BUFSIZE + 1 ]; unsigned char c; - char *p = tmpbuf, *q = line; + char *q = line; tmpbuf[ n_read - 1 ] = '\0'; @@ -428,6 +429,7 @@ static int serveConnection (int conn) p++; } *q = '\0'; + p++; /* Now log it */ logMessage (pri, line); }