X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fntpd.c;h=9e09f81982291dc3b60b3040e93eb4829838a342;hb=b5c5890955fa19651ad8b3f48d99364d270a0d8f;hp=1c97e69ad721c834c93f41b8e6407a65e6d1f3cb;hpb=1fab9727d3020c9c733aab0ab2386f593bd52a11;p=collectd.git diff --git a/src/ntpd.c b/src/ntpd.c index 1c97e69a..9e09f819 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."); } @@ -498,7 +493,7 @@ static int ntpd_receive_response (int req_code, int *res_items, int *res_size, if (status < 0) { char errbuf[1024]; - DEBUG ("recv(2) failed: %s", + INFO ("recv(2) failed: %s", sstrerror (errno, errbuf, sizeof (errbuf))); DEBUG ("Closing socket #%i", sd); close (sd); @@ -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 */