rsyslog patch
--- a/tools/syslogd.c 2011-12-14 14:38:53.557984324 +0530
+++ b/tools/syslogd.c 2011-12-14 14:38:45.011984782 +0530
@@ -3177,6 +3177,7 @@
uchar *LocalHostName;
uchar *LocalDomain;
uchar *LocalFQDNName;
+ int i;
/* first, parse the command line options. We do not carry out any actual work, just
* see what we should do. This relieves us from certain anomalies and we can process
@@ -3316,9 +3317,22 @@
*/
hent = gethostbyname((char*)LocalHostName);
if(hent) {
+ if(hent->h_aliases) {
+ for (i=0; hent->h_aliases[i]; i++) {
+ if(strstr((hent->h_aliases[i]), (char*)LocalHostName)) {
+ //found hostname matching in aliases. use currently found one and break loop
+ break;
+ }
+ }
+ }
+
free(LocalHostName);
- CHKmalloc(LocalHostName = (uchar*)strdup(hent->h_name));
-
+ if(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, '.')))
{
*p++ = '';
Advertisement