This patch from Vitezslav Batrla, is a cleaner fix for the
authorEric Andersen <andersen@codepoet.org>
Fri, 23 May 2003 09:28:01 +0000 (09:28 -0000)
committerEric Andersen <andersen@codepoet.org>
Fri, 23 May 2003 09:28:01 +0000 (09:28 -0000)
problem with syslogd logging the '<' char.

sysklogd/syslogd.c

index bafbaa35ba4242d3123c34a5640c6636fdeec343..416521f3c8bac30187afb5b41cf2bd0ae6dd94ce 100644 (file)
@@ -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)) {