summaryrefslogtreecommitdiff
path: root/sysklogd
diff options
context:
space:
mode:
authorEric Andersen2003-05-23 09:28:01 +0000
committerEric Andersen2003-05-23 09:28:01 +0000
commitd4f90ed37ecfae096dc6bf79f0ca0cefc5ff5756 (patch)
treec75bc8311e717459a31ea83e037247593146105c /sysklogd
parent787ff55a69ad28905f8e8b53fb87e7fafba9b051 (diff)
downloadbusybox-d4f90ed37ecfae096dc6bf79f0ca0cefc5ff5756.zip
busybox-d4f90ed37ecfae096dc6bf79f0ca0cefc5ff5756.tar.gz
This patch from Vitezslav Batrla, is a cleaner fix for the
problem with syslogd logging the '<' char.
Diffstat (limited to 'sysklogd')
-rw-r--r--sysklogd/syslogd.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index bafbaa3..416521f 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -424,31 +424,21 @@ static int serveConnection(char *tmpbuf, int n_read)
while (p < tmpbuf + n_read) {
int pri = (LOG_USER | LOG_NOTICE);
+ int num_lt = 0;
char line[MAXLINE + 1];
unsigned char c;
char *q = line;
- char *p1 = 0;
- int oldpri;
while ((c = *p) && q < &line[sizeof(line) - 1]) {
- if (c == '<' && p1 == 0) {
+ if (c == '<' && num_lt == 0) {
/* Parse the magic priority number. */
- p1 = p;
- oldpri = pri;
+ num_lt++;
pri = 0;
while (isdigit(*(++p))) {
pri = 10 * pri + (*p - '0');
}
- if ( *p != '>') {
- *q++ = c;
- p=p1;
- p1=0;
- pri=oldpri;
- } else {
- if (pri & ~(LOG_FACMASK | LOG_PRIMASK)){
- pri = (LOG_USER | LOG_NOTICE);
- }
- }
+ if (pri & ~(LOG_FACMASK | LOG_PRIMASK)){
+ pri = (LOG_USER | LOG_NOTICE);
} else if (c == '\n') {
*q++ = ' ';
} else if (iscntrl(c) && (c < 0177)) {