[BusyBox-cvs] CVS busybox/sysklogd

CVS User bug1 bug1 at codepoet.org
Tue Sep 14 18:12:14 UTC 2004


Update of /var/cvs/busybox/sysklogd
In directory nail:/tmp/cvs-serv26896/sysklogd

Modified Files:
	syslogd.c 
Log Message:
Patch by Felipe Kellermann, fix a bug introduced in the last patch by adding a condition around the remote logging, also adds some comments.


--- /var/cvs/busybox/sysklogd/syslogd.c	2004/09/08 10:56:06	1.116
+++ /var/cvs/busybox/sysklogd/syslogd.c	2004/09/14 18:12:13	1.117
@@ -432,24 +432,30 @@
 	/* todo: supress duplicates */
 
 #ifdef CONFIG_FEATURE_REMOTE_LOG
-	/* send message to remote logger */
-	if (-1 == remotefd) {
-		init_RemoteLog();
-	}
+	if (doRemoteLog == TRUE) {
+		/* trying connect the socket */
+		if (-1 == remotefd) {
+			init_RemoteLog();
+		}
 
-	if (-1 != remotefd) {
-		now = 1;
-		snprintf(line, sizeof(line), "<%d> %s", pri, msg);
-
-	retry:
-    	if(( -1 == sendto(remotefd, line, strlen(line), 0, 
-						(struct sockaddr *) &remoteaddr, 
-						sizeof(remoteaddr))) && (errno == EINTR)) {
-			sleep(now);
-			now *= 2;
-			goto retry;
+		/* if we have a valid socket, send the message */
+		if (-1 != remotefd) {
+			now = 1;
+			snprintf(line, sizeof(line), "<%d> %s", pri, msg);
+
+		retry:
+			/* send message to remote logger */
+			if(( -1 == sendto(remotefd, line, strlen(line), 0,
+							(struct sockaddr *) &remoteaddr,
+							sizeof(remoteaddr))) && (errno == EINTR)) {
+				/* sleep now seconds and retry (with now * 2) */
+				sleep(now);
+				now *= 2;
+				goto retry;
+			}
 		}
 	}
+
 	if (local_logging == TRUE)
 #endif
 	{



More information about the busybox-cvs mailing list