aboutsummaryrefslogtreecommitdiff
path: root/sysklogd/syslogd.c
diff options
context:
space:
mode:
authorbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-09-14 18:12:13 +0000
committerbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-09-14 18:12:13 +0000
commit5857642c0c6de442d77c9eb260e132f8892d1e77 (patch)
treeb99647c7f1dc979ff0cdc77a8ec0a3feeccaf29f /sysklogd/syslogd.c
parent5b99d1e5878ec18eb6816cd753aaf96a2e50f54e (diff)
downloadbusybox-w32-5857642c0c6de442d77c9eb260e132f8892d1e77.tar.gz
busybox-w32-5857642c0c6de442d77c9eb260e132f8892d1e77.tar.bz2
busybox-w32-5857642c0c6de442d77c9eb260e132f8892d1e77.zip
Patch by Felipe Kellermann, fix a bug introduced in the last patch by adding a condition around the remote logging, also adds some comments.
git-svn-id: svn://busybox.net/trunk/busybox@9251 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'sysklogd/syslogd.c')
-rw-r--r--sysklogd/syslogd.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index ef9cf2162..8c6c44ee0 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -432,24 +432,30 @@ static void logMessage(int pri, char *msg)
432 /* todo: supress duplicates */ 432 /* todo: supress duplicates */
433 433
434#ifdef CONFIG_FEATURE_REMOTE_LOG 434#ifdef CONFIG_FEATURE_REMOTE_LOG
435 /* send message to remote logger */ 435 if (doRemoteLog == TRUE) {
436 if (-1 == remotefd) { 436 /* trying connect the socket */
437 init_RemoteLog(); 437 if (-1 == remotefd) {
438 } 438 init_RemoteLog();
439 }
439 440
440 if (-1 != remotefd) { 441 /* if we have a valid socket, send the message */
441 now = 1; 442 if (-1 != remotefd) {
442 snprintf(line, sizeof(line), "<%d> %s", pri, msg); 443 now = 1;
443 444 snprintf(line, sizeof(line), "<%d> %s", pri, msg);
444 retry: 445
445 if(( -1 == sendto(remotefd, line, strlen(line), 0, 446 retry:
446 (struct sockaddr *) &remoteaddr, 447 /* send message to remote logger */
447 sizeof(remoteaddr))) && (errno == EINTR)) { 448 if(( -1 == sendto(remotefd, line, strlen(line), 0,
448 sleep(now); 449 (struct sockaddr *) &remoteaddr,
449 now *= 2; 450 sizeof(remoteaddr))) && (errno == EINTR)) {
450 goto retry; 451 /* sleep now seconds and retry (with now * 2) */
452 sleep(now);
453 now *= 2;
454 goto retry;
455 }
451 } 456 }
452 } 457 }
458
453 if (local_logging == TRUE) 459 if (local_logging == TRUE)
454#endif 460#endif
455 { 461 {