X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fzookeeper.c;h=047985822823be1cf4325c6427163a13a931f7ef;hb=9521a596cb88b044a2f08db53520edd6e15c8d39;hp=860e93d768e927dffa81a18a614f9cabda82bb42;hpb=4489345f2549883041e4a2b0b0157cda16fbe2e1;p=collectd.git diff --git a/src/zookeeper.c b/src/zookeeper.c index 860e93d7..04798582 100644 --- a/src/zookeeper.c +++ b/src/zookeeper.c @@ -25,6 +25,7 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" @@ -105,18 +106,19 @@ static int zookeeper_connect (void) { int sk = -1; int status; - struct addrinfo ai_hints; struct addrinfo *ai; struct addrinfo *ai_list; const char *host; const char *port; - memset (&ai_hints, '\0', sizeof (ai_hints)); - ai_hints.ai_family = AF_UNSPEC; - ai_hints.ai_socktype = SOCK_STREAM; - host = (zk_host != NULL) ? zk_host : ZOOKEEPER_DEF_HOST; port = (zk_port != NULL) ? zk_port : ZOOKEEPER_DEF_PORT; + + struct addrinfo ai_hints = { + .ai_family = AF_UNSPEC, + .ai_socktype = SOCK_STREAM + }; + status = getaddrinfo (host, port, &ai_hints, &ai_list); if (status != 0) {