X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fntpd.c;h=63b037a6440eb8006027dac12b8355cde0e24b5b;hb=747f853a2ce3f8a55438aff274df5ea25a3e9cce;hp=1c97e69ad721c834c93f41b8e6407a65e6d1f3cb;hpb=b577149d350722ba57d995f27cff8bcf0daeabb9;p=collectd.git diff --git a/src/ntpd.c b/src/ntpd.c index 1c97e69a..63b037a6 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -24,12 +24,6 @@ #include "plugin.h" #include "configfile.h" -#if HAVE_SYS_SOCKET_H -# define NTPD_HAVE_READ 1 -#else -# define NTPD_HAVE_READ 0 -#endif - #if HAVE_STDINT_H # include #endif @@ -60,7 +54,6 @@ static const char *config_keys[] = }; static int config_keys_num = 2; -#if NTPD_HAVE_READ # define NTPD_DEFAULT_HOST "localhost" # define NTPD_DEFAULT_PORT "123" static int sock_descr = -1; @@ -355,7 +348,10 @@ static int ntpd_connect (void) port = NTPD_DEFAULT_PORT; memset (&ai_hints, '\0', sizeof (ai_hints)); - ai_hints.ai_flags = AI_ADDRCONFIG; + ai_hints.ai_flags = 0; +#ifdef AI_ADDRCONFIG + ai_hints.ai_flags |= AI_ADDRCONFIG; +#endif ai_hints.ai_family = PF_UNSPEC; ai_hints.ai_socktype = SOCK_DGRAM; ai_hints.ai_protocol = IPPROTO_UDP; @@ -394,7 +390,6 @@ static int ntpd_connect (void) if (sock_descr < 0) { - DEBUG ("Unable to connect to server."); ERROR ("ntpd plugin: Unable to connect to server."); } @@ -956,13 +951,10 @@ static int ntpd_read (void) return (0); } /* int ntpd_read */ -#endif /* NTPD_HAVE_READ */ void module_register (void) { -#if NTPD_HAVE_READ plugin_register_config ("ntpd", ntpd_config, config_keys, config_keys_num); plugin_register_read ("ntpd", ntpd_read); -#endif /* NTPD_HAVE_READ */ } /* void module_register */