Patch by Felipe Kellermann, fix a bug introduced in the last patch by adding a condition around the remote logging, also adds some comments.
This commit is contained in:
parent
d4004ee6a9
commit
73ebb889da
@ -432,24 +432,30 @@ static void logMessage(int pri, char *msg)
|
|||||||
/* todo: supress duplicates */
|
/* todo: supress duplicates */
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_REMOTE_LOG
|
#ifdef CONFIG_FEATURE_REMOTE_LOG
|
||||||
/* send message to remote logger */
|
if (doRemoteLog == TRUE) {
|
||||||
if (-1 == remotefd) {
|
/* trying connect the socket */
|
||||||
init_RemoteLog();
|
if (-1 == remotefd) {
|
||||||
}
|
init_RemoteLog();
|
||||||
|
}
|
||||||
|
|
||||||
if (-1 != remotefd) {
|
/* if we have a valid socket, send the message */
|
||||||
now = 1;
|
if (-1 != remotefd) {
|
||||||
snprintf(line, sizeof(line), "<%d> %s", pri, msg);
|
now = 1;
|
||||||
|
snprintf(line, sizeof(line), "<%d> %s", pri, msg);
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
if(( -1 == sendto(remotefd, line, strlen(line), 0,
|
/* send message to remote logger */
|
||||||
(struct sockaddr *) &remoteaddr,
|
if(( -1 == sendto(remotefd, line, strlen(line), 0,
|
||||||
sizeof(remoteaddr))) && (errno == EINTR)) {
|
(struct sockaddr *) &remoteaddr,
|
||||||
sleep(now);
|
sizeof(remoteaddr))) && (errno == EINTR)) {
|
||||||
now *= 2;
|
/* sleep now seconds and retry (with now * 2) */
|
||||||
goto retry;
|
sleep(now);
|
||||||
|
now *= 2;
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local_logging == TRUE)
|
if (local_logging == TRUE)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user