diff options
-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 | { |