diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-01-18 13:55:16 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-01-18 13:55:16 +0100 |
commit | c9b70abf1a7a40b5afc80975d016980dd4e63e36 (patch) | |
tree | 33171a0c1dae68dc1ab650e3ab24bd973584cf84 /tools | |
parent | fe4cfa6d1f37aaac61a7cbab03df30ac1909f5cf (diff) | |
parent | 92f7e549df5a1333f037cf3b290e3087fd9ad5da (diff) | |
download | rsyslog-c9b70abf1a7a40b5afc80975d016980dd4e63e36.tar.gz rsyslog-c9b70abf1a7a40b5afc80975d016980dd4e63e36.tar.xz rsyslog-c9b70abf1a7a40b5afc80975d016980dd4e63e36.zip |
Merge branch 'v5-stable' into v6-stable
Conflicts:
ChangeLog
configure.ac
doc/manual.html
plugins/imptcp/imptcp.c
Diffstat (limited to 'tools')
-rw-r--r-- | tools/syslogd.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c index 78b9933f..083bd107 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -2680,8 +2680,28 @@ int realMain(int argc, char **argv) */ hent = gethostbyname((char*)LocalHostName); if(hent) { + int i = 0; + + if(hent->h_aliases) { + size_t hnlen; + + hnlen = strlen((char *) LocalHostName); + + for (i = 0; hent->h_aliases[i]; i++) { + if (!strncmp(hent->h_aliases[i], (char *) LocalHostName, hnlen) + && hent->h_aliases[i][hnlen] == '.') { + /* found a matching hostname */ + break; + } + } + } + free(LocalHostName); - CHKmalloc(LocalHostName = (uchar*)strdup(hent->h_name)); + if(hent->h_aliases && hent->h_aliases[i]) { + CHKmalloc(LocalHostName = (uchar*)strdup(hent->h_aliases[i])); + } else { + CHKmalloc(LocalHostName = (uchar*)strdup(hent->h_name)); + } if((p = (uchar*)strchr((char*)LocalHostName, '.'))) { |