X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fcollectd.c;h=28fa7155f9de84c60900178f1fed29a86530eec1;hb=6378ec288f34ff250b2971a1452338a2b34c240a;hp=0149f4053511165eabcf7dab23e048c30f106958;hpb=ab93a143ac2c908b4cc692669290a1e9c26c62e9;p=collectd.git diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c index 0149f405..28fa7155 100644 --- a/src/daemon/collectd.c +++ b/src/daemon/collectd.c @@ -28,9 +28,9 @@ #include "cmd.h" #include "collectd.h" -#include "common.h" #include "configfile.h" #include "plugin.h" +#include "utils/common/common.h" #include #include @@ -51,6 +51,14 @@ #define COLLECTD_LOCALE "C" #endif +#ifdef WIN32 +#undef COLLECT_DAEMON +#include +#undef gethostname +#include +#include +#endif + static int loop; static int init_hostname(void) { @@ -60,10 +68,14 @@ static int init_hostname(void) { return 0; } +#ifdef WIN32 + long hostname_len = NI_MAXHOST; +#else long hostname_len = sysconf(_SC_HOST_NAME_MAX); if (hostname_len == -1) { hostname_len = NI_MAXHOST; } +#endif /* WIN32 */ char hostname[hostname_len]; if (gethostname(hostname, hostname_len) != 0) {