Only play with the network when the syslog port can be determined.
authorJoey Schulze <joey@infodrom.org>
Mon, 21 May 2007 11:00:35 +0000 (11:00 +0000)
committerJoey Schulze <joey@infodrom.org>
Mon, 21 May 2007 11:00:35 +0000 (11:00 +0000)
Ignore networking otherwise, but continue working. (Debian Bug#226611)

syslogd.c

index 515aa90..72df0db 100644 (file)
--- a/syslogd.c
+++ b/syslogd.c
@@ -2288,11 +2288,15 @@ void init()
 
        sp = getservbyname("syslog", "udp");
        if (sp == NULL) {
+               if (errno == ENOENT) {
+                       errno = 0;
+                       logerror("The file /etc/services does not seem exist.");
+               }
                errno = 0;
                logerror("network logging disabled (syslog/udp service unknown).");
                logerror("see syslogd(8) for details of whether and how to enable it.");
-               return;
-       }
+               LogPort = 0;
+       } else
        LogPort = sp->s_port;
 
        /*
@@ -2686,6 +2690,12 @@ void cfline(line, f)
        {
        case '@':
 #ifdef SYSLOG_INET
+               if (!LogPort) {
+                       f->f_type = F_UNUSED;
+                       logerror("Forward rule without networking enabled");
+                       break;
+               }
+
                (void) strcpy(f->f_un.f_forw.f_hname, ++p);
                dprintf("forwarding host: %s\n", p);    /*ASP*/
                if ( (hp = gethostbyname(p)) == NULL ) {