diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2004-09-14 18:12:13 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2004-09-14 18:12:13 +0000 |
commit | 73ebb889daf30980bddc3d3065ff10844c4624dc (patch) | |
tree | b99647c7f1dc979ff0cdc77a8ec0a3feeccaf29f | |
parent | d4004ee6a933eaf3d3843624d8c63e922db8d7dd (diff) | |
download | busybox-w32-73ebb889daf30980bddc3d3065ff10844c4624dc.tar.gz busybox-w32-73ebb889daf30980bddc3d3065ff10844c4624dc.tar.bz2 busybox-w32-73ebb889daf30980bddc3d3065ff10844c4624dc.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.
-rw-r--r-- | sysklogd/syslogd.c | 36 |
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 | { |