diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-05-23 09:28:01 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-05-23 09:28:01 +0000 |
commit | d4f90ed37ecfae096dc6bf79f0ca0cefc5ff5756 (patch) | |
tree | c75bc8311e717459a31ea83e037247593146105c | |
parent | 787ff55a69ad28905f8e8b53fb87e7fafba9b051 (diff) | |
download | busybox-w32-d4f90ed37ecfae096dc6bf79f0ca0cefc5ff5756.tar.gz busybox-w32-d4f90ed37ecfae096dc6bf79f0ca0cefc5ff5756.tar.bz2 busybox-w32-d4f90ed37ecfae096dc6bf79f0ca0cefc5ff5756.zip |
This patch from Vitezslav Batrla, is a cleaner fix for the
problem with syslogd logging the '<' char.
-rw-r--r-- | sysklogd/syslogd.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index bafbaa35b..416521f3c 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -424,31 +424,21 @@ static int serveConnection(char *tmpbuf, int n_read) | |||
424 | while (p < tmpbuf + n_read) { | 424 | while (p < tmpbuf + n_read) { |
425 | 425 | ||
426 | int pri = (LOG_USER | LOG_NOTICE); | 426 | int pri = (LOG_USER | LOG_NOTICE); |
427 | int num_lt = 0; | ||
427 | char line[MAXLINE + 1]; | 428 | char line[MAXLINE + 1]; |
428 | unsigned char c; | 429 | unsigned char c; |
429 | char *q = line; | 430 | char *q = line; |
430 | char *p1 = 0; | ||
431 | int oldpri; | ||
432 | 431 | ||
433 | while ((c = *p) && q < &line[sizeof(line) - 1]) { | 432 | while ((c = *p) && q < &line[sizeof(line) - 1]) { |
434 | if (c == '<' && p1 == 0) { | 433 | if (c == '<' && num_lt == 0) { |
435 | /* Parse the magic priority number. */ | 434 | /* Parse the magic priority number. */ |
436 | p1 = p; | 435 | num_lt++; |
437 | oldpri = pri; | ||
438 | pri = 0; | 436 | pri = 0; |
439 | while (isdigit(*(++p))) { | 437 | while (isdigit(*(++p))) { |
440 | pri = 10 * pri + (*p - '0'); | 438 | pri = 10 * pri + (*p - '0'); |
441 | } | 439 | } |
442 | if ( *p != '>') { | 440 | if (pri & ~(LOG_FACMASK | LOG_PRIMASK)){ |
443 | *q++ = c; | 441 | pri = (LOG_USER | LOG_NOTICE); |
444 | p=p1; | ||
445 | p1=0; | ||
446 | pri=oldpri; | ||
447 | } else { | ||
448 | if (pri & ~(LOG_FACMASK | LOG_PRIMASK)){ | ||
449 | pri = (LOG_USER | LOG_NOTICE); | ||
450 | } | ||
451 | } | ||
452 | } else if (c == '\n') { | 442 | } else if (c == '\n') { |
453 | *q++ = ' '; | 443 | *q++ = ' '; |
454 | } else if (iscntrl(c) && (c < 0177)) { | 444 | } else if (iscntrl(c) && (c < 0177)) { |