X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fntpd.c;h=02c9f6dc9566cc7e11d0fe1302849a76013ec894;hb=f3610533206238bf4fcb72c76e9a07517d8bc64b;hp=f7b57ba30ce30ecc3c7826f879d2d4bb99629028;hpb=69b8a9a1af204685dfdfaf1279a0f2928e0bbb32;p=collectd.git diff --git a/src/ntpd.c b/src/ntpd.c index f7b57ba3..02c9f6dc 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -28,6 +28,7 @@ #define _BSD_SOURCE /* For NI_MAXHOST */ #include "collectd.h" + #include "common.h" #include "plugin.h" #include "configfile.h" @@ -346,7 +347,6 @@ static int ntpd_connect (void) const char *host; const char *port; - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_list; struct addrinfo *ai_ptr; int status; @@ -364,12 +364,12 @@ static int ntpd_connect (void) if (strlen (port) == 0) port = NTPD_DEFAULT_PORT; -#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; + struct addrinfo ai_hints = { + .ai_family = AF_UNSPEC, + .ai_flags = AI_ADDRCONFIG, + .ai_protocol = IPPROTO_UDP, + .ai_socktype = SOCK_DGRAM + }; if ((status = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0) {