aboutsummaryrefslogtreecommitdiff
path: root/syslogd.c
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-04-18 00:00:52 +0000
committerErik Andersen <andersen@codepoet.org>2000-04-18 00:00:52 +0000
commita6c752201e9031b51a6d89349f1cec1f690f56ef (patch)
tree808a54e0dc112d8b32326ccdb411e4300dc65d76 /syslogd.c
parent91e581fa0438b39ceb0ffb4ddcb90ee4d260ae81 (diff)
downloadbusybox-w32-a6c752201e9031b51a6d89349f1cec1f690f56ef.tar.gz
busybox-w32-a6c752201e9031b51a6d89349f1cec1f690f56ef.tar.bz2
busybox-w32-a6c752201e9031b51a6d89349f1cec1f690f56ef.zip
Updates
-Erik
Diffstat (limited to 'syslogd.c')
-rw-r--r--syslogd.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/syslogd.c b/syslogd.c
index 8827265d5..228d0a17a 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -226,18 +226,20 @@ static void doSyslogd (void)
226 } 226 }
227 else { 227 else {
228#define BUFSIZE 1024 + 1 228#define BUFSIZE 1024 + 1
229 char buf[BUFSIZE]; 229 char buf;
230 char *q, *p; 230 char *q, *p;
231 int n_read; 231 int n_read;
232 char line[BUFSIZE]; 232 char line[BUFSIZE];
233 unsigned char c; 233 unsigned char c;
234 int pri;
234 235
235 /* Keep reading stuff till there is nothing else to read */ 236 /* Get set to read in a line */
236 while( (n_read = read (fd, buf, BUFSIZE)) > 0 && errno != EOF) { 237 memset (line, 0, sizeof(line));
237 int pri = (LOG_USER | LOG_NOTICE); 238 pri = (LOG_USER | LOG_NOTICE);
238 239
239 memset (line, 0, sizeof(line)); 240 /* Keep reading stuff till there is nothing else to read */
240 p = buf; 241 while( (n_read = read (fd, &buf, 1)) > 0) {
242 p = &buf;
241 q = line; 243 q = line;
242 while (p && (c = *p) && q < &line[sizeof(line) - 1]) { 244 while (p && (c = *p) && q < &line[sizeof(line) - 1]) {
243 if (c == '<') { 245 if (c == '<') {
@@ -262,6 +264,7 @@ static void doSyslogd (void)
262 264
263 /* Now log it */ 265 /* Now log it */
264 logMessage(pri, line); 266 logMessage(pri, line);
267 break;
265 } 268 }
266 close (fd); 269 close (fd);
267 FD_CLR (fd, &readfds); 270 FD_CLR (fd, &readfds);