[BusyBox-cvs] busybox.stable syslogd.c,1.90,1.91

Erik Andersen andersen at busybox.net
Fri May 23 09:26:33 UTC 2003


Update of /var/cvs/busybox.stable
In directory winder:/tmp/cvs-serv1234

Modified Files:
	syslogd.c 
Log Message:
This patch from Vitezslav Batrla, is a cleaner fix for the
problem with syslogd logging the '<' char.


Index: syslogd.c
===================================================================
RCS file: /var/cvs/busybox.stable/syslogd.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- syslogd.c	16 May 2003 08:35:02 -0000	1.90
+++ syslogd.c	23 May 2003 09:26:29 -0000	1.91
@@ -407,31 +407,22 @@
 	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++ = ' ';



More information about the busybox-cvs mailing list