← Commit list

73ebb889d

Glenn L McGrath
Glenn L McGrath
2004-09-14
FAILED Duration: 26s

Subject

Patch by Felipe Kellermann, fix a bug introduced in the last patch by adding a condition around the remote logging, also adds some comments.

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

sysklogd/syslogd.c+21 -15
@@ -432,24 +432,30 @@ static void logMessage(int pri, char *msg)
/* 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
{