summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-04-16 18:01:26 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-04-16 18:01:26 +0200
commitbf3e0d4f224a26e2ac9bc3edfd1e6eedcf56c9f8 (patch)
treec74263495311d4ffbeb55f0fb27d102144f55024 /tools
parent5987107df46157eb847bc8271157ab8a7c73f6f4 (diff)
downloadrsyslog-bf3e0d4f224a26e2ac9bc3edfd1e6eedcf56c9f8.tar.gz
rsyslog-bf3e0d4f224a26e2ac9bc3edfd1e6eedcf56c9f8.tar.xz
rsyslog-bf3e0d4f224a26e2ac9bc3edfd1e6eedcf56c9f8.zip
prevented segfault during runtime library init phase
Diffstat (limited to 'tools')
-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);