Logrunner uses the official hostname (FQDN) instead of the
authorarjen <arjen>
Wed, 21 Nov 2007 15:23:32 +0000 (15:23 +0000)
committerarjen <arjen>
Wed, 21 Nov 2007 15:23:32 +0000 (15:23 +0000)
hostname returned by gethostname().

src/gcm_input/logrunner.cpp

index 2de9902..1e92471 100644 (file)
@@ -2,7 +2,7 @@
  * logrunner.c
  * (c) Peter Roozemaal, feb 2003
  *
- * $Id: logrunner.cpp,v 1.4 2007-10-27 08:46:21 arjen Exp $
+ * $Id: logrunner.cpp,v 1.5 2007-11-21 15:23:32 arjen Exp $
  *
  * 1) compile,
  * 2) Add 'logfile' elements to the gnucomo configuration file
@@ -194,7 +194,16 @@ void xml_header(String type)
    char buffer[256];
    *buffer = 0;
    gethostname(buffer, sizeof(buffer));
-        xsend("<?xml version='1.0'?>\n");
+
+   //  Try to obtain the official name of the host (FQDN)
+   host = gethostbyname(buffer);
+   if (host != NULL)
+   {
+      strcpy(buffer, host->h_name);
+   }
+
+   xsend("<?xml version='1.0'?>\n");
    xsend("<gcmt:message xmlns:gcmt=\"http://gnucomo.org/transport/\">\n");
    xsend("<gcmt:header>\n<gcmt:hostname>");
    xsend(buffer);