diff options
Diffstat (limited to 'sysklogd/syslogd.c')
| -rw-r--r-- | sysklogd/syslogd.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 8827265d5..228d0a17a 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/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); |
