Only try to gather the local domain name when messages are received
authorJoey Schulze <joey@infodrom.org>
Sat, 26 May 2007 08:05:05 +0000 (08:05 +0000)
committerJoey Schulze <joey@infodrom.org>
Sat, 26 May 2007 08:05:05 +0000 (08:05 +0000)
from the network, it's not needed otherwise.

syslogd.c

index 9049446..5d8d59a 100644 (file)
--- a/syslogd.c
+++ b/syslogd.c
@@ -761,6 +761,7 @@ struct code FacNames[] = {
 int    Debug;                  /* debug flag */
 char   LocalHostName[MAXHOSTNAMELEN+1];        /* our hostname */
 char   *LocalDomain;           /* our local domain name */
+char   *emptystring = "";
 int    InetInuse = 0;          /* non-zero if INET sockets are being used */
 int    finet = -1;             /* Internet datagram socket */
 int    LogPort;                /* port number for INET connections */
@@ -988,14 +989,13 @@ int main(argc, argv)
        consfile.f_type = F_CONSOLE;
        (void) strcpy(consfile.f_un.f_fname, ctty);
        (void) gethostname(LocalHostName, sizeof(LocalHostName));
+       LocalDomain = emptystring;
        if ( (p = strchr(LocalHostName, '.')) ) {
                *p++ = '\0';
                LocalDomain = p;
        }
-       else
+       else if ( AcceptRemote )
        {
-               LocalDomain = "";
-
                /*
                 * It's not clearly defined whether gethostname()
                 * should return the simple hostname or the fqdn. A