summaryrefslogtreecommitdiffstats
path: root/tools/syslogd.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/syslogd.c')
-rw-r--r--tools/syslogd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index a356c338..6f252b3a 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -292,7 +292,7 @@ uchar *pszWorkDir = NULL;/* name of rsyslog's spool directory (without trailing
uchar *glblModPath = NULL; /* module load path - only used during initial init, only settable via -M command line option */
/* end global config file state variables */
-uchar *LocalHostName;/* our hostname - read-only after startup */
+uchar *LocalHostName = NULL;/* our hostname - read-only after startup */
char *LocalDomain; /* our local domain name - read-only after startup */
int MarkInterval = 20 * 60; /* interval between marks in seconds - read-only after startup */
int family = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both), set via cmdline */
@@ -882,8 +882,8 @@ logmsgInternal(int pri, char *msg, int flags)
CHKiRet(msgConstruct(&pMsg));
MsgSetUxTradMsg(pMsg, msg);
MsgSetRawMsg(pMsg, msg);
- MsgSetHOSTNAME(pMsg, (char*)LocalHostName);
- MsgSetRcvFrom(pMsg, (char*)LocalHostName);
+ MsgSetHOSTNAME(pMsg, (LocalHostName == NULL) ? "[localhost]" : (char*)LocalHostName);
+ MsgSetRcvFrom(pMsg, (LocalHostName == NULL) ? "[localhost]" : (char*)LocalHostName);
MsgSetTAG(pMsg, "rsyslogd:");
pMsg->iFacility = LOG_FAC(pri);
pMsg->iSeverity = LOG_PRI(pri);