From aa3811995bfae69f0d1a0f897acfa4a9a4c0138a Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Tue, 2 Aug 2016 16:27:17 +0200 Subject: [PATCH] treewide: use designated initializers for ai_hints --- src/apcups.c | 7 ++++--- src/chrony.c | 11 ++++++----- src/daemon/collectd.c | 5 +++-- src/daemon/common.c | 6 ++++-- src/gmond.c | 11 ++++++----- src/hddtemp.c | 13 +++++++------ src/libcollectdclient/client.c | 12 +++++++----- src/libcollectdclient/network.c | 9 +++++---- src/mbmon.c | 13 +++++++------ src/memcached.c | 13 +++++++------ src/modbus.c | 15 +++++++-------- src/network.c | 22 ++++++++++++---------- src/ntpd.c | 11 ++++++----- src/olsrd.c | 14 ++++++++------ src/pinba.c | 15 +++++++-------- src/statsd.c | 9 +++++---- src/teamspeak2.c | 9 +++++---- src/write_graphite.c | 7 ++++--- src/write_sensu.c | 14 ++++++++------ src/write_tsdb.c | 11 ++++++----- src/zookeeper.c | 10 ++++++---- 21 files changed, 130 insertions(+), 107 deletions(-) diff --git a/src/apcups.c b/src/apcups.c index 84249339..aa0be835 100644 --- a/src/apcups.c +++ b/src/apcups.c @@ -115,13 +115,14 @@ static int net_open (char const *node, char const *service) { int sd; int status; - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_return; struct addrinfo *ai_list; /* TODO: Change this to `AF_UNSPEC' if apcupsd can handle IPv6 */ - ai_hints.ai_family = AF_INET; - ai_hints.ai_socktype = SOCK_STREAM; + struct addrinfo ai_hints = { + .ai_family = AF_INET, + .ai_socktype = SOCK_STREAM + }; status = getaddrinfo (node, service, &ai_hints, &ai_return); if (status != 0) diff --git a/src/chrony.c b/src/chrony.c index 4a09753f..9c40dd33 100644 --- a/src/chrony.c +++ b/src/chrony.c @@ -306,14 +306,15 @@ static int connect_client(const char *p_hostname, const char *p_service, int p_family, int p_socktype) { - struct addrinfo hints = { 0 }; - struct addrinfo *res = NULL, *ressave = NULL; + struct addrinfo *res, *ressave; int n, sockfd; - hints.ai_family = p_family; - hints.ai_socktype = p_socktype; + struct addrinfo ai_hints = { + .ai_family = p_family, + .ai_socktype = p_socktype + }; - n = getaddrinfo(p_hostname, p_service, &hints, &res); + n = getaddrinfo(p_hostname, p_service, &ai_hints, &res); if (n < 0) { diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c index 84052088..3a6fe1e9 100644 --- a/src/daemon/collectd.c +++ b/src/daemon/collectd.c @@ -97,7 +97,6 @@ static int init_hostname (void) { const char *str; - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_list; struct addrinfo *ai_ptr; int status; @@ -120,7 +119,9 @@ static int init_hostname (void) if (IS_FALSE (str)) return (0); - ai_hints.ai_flags = AI_CANONNAME; + struct addrinfo ai_hints = { + .ai_flags = AI_CANONNAME + }; status = getaddrinfo (hostname_g, NULL, &ai_hints, &ai_list); if (status != 0) diff --git a/src/daemon/common.c b/src/daemon/common.c index 9da47755..b3bc7532 100644 --- a/src/daemon/common.c +++ b/src/daemon/common.c @@ -1518,7 +1518,6 @@ int service_name_to_port_number (const char *service_name) { struct addrinfo *ai_list; struct addrinfo *ai_ptr; - struct addrinfo ai_hints = { 0 }; int status; int service_number; @@ -1526,7 +1525,10 @@ int service_name_to_port_number (const char *service_name) return (-1); ai_list = NULL; - ai_hints.ai_family = AF_UNSPEC; + + struct addrinfo ai_hints = { + .ai_family = AF_UNSPEC + }; status = getaddrinfo (/* node = */ NULL, service_name, &ai_hints, &ai_list); diff --git a/src/gmond.c b/src/gmond.c index 9dda84c9..cfe7eaf4 100644 --- a/src/gmond.c +++ b/src/gmond.c @@ -211,7 +211,6 @@ static int create_sockets (socket_entry_t **ret_sockets, /* {{{ */ size_t *ret_sockets_num, const char *node, const char *service, int listen) { - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_list; struct addrinfo *ai_ptr; int ai_return; @@ -224,10 +223,12 @@ static int create_sockets (socket_entry_t **ret_sockets, /* {{{ */ if (*ret_sockets != NULL) return (EINVAL); - ai_hints.ai_flags = AI_ADDRCONFIG | AI_PASSIVE; - ai_hints.ai_family = AF_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_PASSIVE, + .ai_protocol = IPPROTO_UDP, + .ai_socktype = SOCK_DGRAM + }; ai_return = getaddrinfo (node, service, &ai_hints, &ai_list); if (ai_return != 0) diff --git a/src/hddtemp.c b/src/hddtemp.c index bda41a19..1b7ed329 100644 --- a/src/hddtemp.c +++ b/src/hddtemp.c @@ -88,15 +88,9 @@ static int hddtemp_query_daemon (char *buffer, int buffer_size) const char *host; const char *port; - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_list, *ai_ptr; int ai_return; - ai_hints.ai_flags = AI_ADDRCONFIG; - ai_hints.ai_family = PF_UNSPEC; - ai_hints.ai_socktype = SOCK_STREAM; - ai_hints.ai_protocol = IPPROTO_TCP; - host = hddtemp_host; if (host == NULL) host = HDDTEMP_DEF_HOST; @@ -105,6 +99,13 @@ static int hddtemp_query_daemon (char *buffer, int buffer_size) if (strlen (port) == 0) port = HDDTEMP_DEF_PORT; + struct addrinfo ai_hints = { + .ai_flags = AI_ADDRCONFIG, + .ai_family = PF_UNSPEC, + .ai_protocol = IPPROTO_TCP, + .ai_socktype = SOCK_STREAM + }; + if ((ai_return = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0) { char errbuf[1024]; diff --git a/src/libcollectdclient/client.c b/src/libcollectdclient/client.c index 58c4e671..fea9360e 100644 --- a/src/libcollectdclient/client.c +++ b/src/libcollectdclient/client.c @@ -420,7 +420,6 @@ static int lcc_open_unixsocket (lcc_connection_t *c, const char *path) /* {{{ */ static int lcc_open_netsocket (lcc_connection_t *c, /* {{{ */ const char *addr_orig) { - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_res; struct addrinfo *ai_ptr; char addr_copy[NI_MAXHOST]; @@ -437,10 +436,6 @@ static int lcc_open_netsocket (lcc_connection_t *c, /* {{{ */ addr_copy[sizeof(addr_copy) - 1] = '\0'; addr = addr_copy; - ai_hints.ai_flags = AI_ADDRCONFIG; - ai_hints.ai_family = AF_UNSPEC; - ai_hints.ai_socktype = SOCK_STREAM; - port = NULL; if (*addr == '[') /* IPv6+port format */ { @@ -477,6 +472,13 @@ static int lcc_open_netsocket (lcc_connection_t *c, /* {{{ */ } ai_res = NULL; + + struct addrinfo ai_hints = { + .ai_family = AF_UNSPEC, + .ai_flags = AI_ADDRCONFIG, + .ai_socktype = SOCK_STREAM + }; + status = getaddrinfo (addr, port == NULL ? LCC_DEFAULT_PORT : port, &ai_hints, &ai_res); diff --git a/src/libcollectdclient/network.c b/src/libcollectdclient/network.c index fdca6e45..afbee6e8 100644 --- a/src/libcollectdclient/network.c +++ b/src/libcollectdclient/network.c @@ -119,7 +119,6 @@ static void int_server_destroy (lcc_server_t *srv) /* {{{ */ static int server_open_socket (lcc_server_t *srv) /* {{{ */ { - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_list = NULL; struct addrinfo *ai_ptr; int status; @@ -130,9 +129,11 @@ static int server_open_socket (lcc_server_t *srv) /* {{{ */ if (srv->fd >= 0) server_close_socket (srv); - ai_hints.ai_flags = AI_ADDRCONFIG; - ai_hints.ai_family = AF_UNSPEC; - ai_hints.ai_socktype = SOCK_DGRAM; + struct addrinfo ai_hints = { + .ai_family = AF_UNSPEC, + .ai_flags = AI_ADDRCONFIG, + .ai_socktype = SOCK_DGRAM + }; status = getaddrinfo (srv->node, srv->service, &ai_hints, &ai_list); if (status != 0) diff --git a/src/mbmon.c b/src/mbmon.c index bec6bdf2..1f0a0d63 100644 --- a/src/mbmon.c +++ b/src/mbmon.c @@ -84,15 +84,9 @@ static int mbmon_query_daemon (char *buffer, int buffer_size) const char *host; const char *port; - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_list, *ai_ptr; int ai_return; - ai_hints.ai_flags = AI_ADDRCONFIG; - ai_hints.ai_family = PF_UNSPEC; - ai_hints.ai_socktype = SOCK_STREAM; - ai_hints.ai_protocol = IPPROTO_TCP; - host = mbmon_host; if (host == NULL) host = MBMON_DEF_HOST; @@ -101,6 +95,13 @@ static int mbmon_query_daemon (char *buffer, int buffer_size) if (port == NULL) port = MBMON_DEF_PORT; + struct addrinfo ai_hints = { + .ai_family = PF_UNSPEC, + .ai_flags = AI_ADDRCONFIG, + .ai_protocol = IPPROTO_TCP, + .ai_socktype = SOCK_STREAM + }; + if ((ai_return = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0) { char errbuf[1024]; diff --git a/src/memcached.c b/src/memcached.c index 17a77609..c0c9e70c 100644 --- a/src/memcached.c +++ b/src/memcached.c @@ -101,20 +101,21 @@ static int memcached_connect_inet (memcached_t *st) const char *host; const char *port; - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_list, *ai_ptr; int status; int fd = -1; - ai_hints.ai_flags = AI_ADDRCONFIG; - ai_hints.ai_family = AF_UNSPEC; - ai_hints.ai_socktype = SOCK_STREAM; - ai_hints.ai_protocol = 0; - host = (st->host != NULL) ? st->host : MEMCACHED_DEF_HOST; port = (st->port != NULL) ? st->port : MEMCACHED_DEF_PORT; ai_list = NULL; + + struct addrinfo ai_hints = { + .ai_family = AF_UNSPEC, + .ai_flags = AI_ADDRCONFIG, + .ai_socktype = SOCK_STREAM + }; + status = getaddrinfo (host, port, &ai_hints, &ai_list); if (status != 0) { diff --git a/src/modbus.c b/src/modbus.c index c58cb398..a2150600 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -818,20 +818,19 @@ static int mb_config_set_host_address (mb_host_t *host, /* {{{ */ { struct addrinfo *ai_list; struct addrinfo *ai_ptr; - struct addrinfo ai_hints = { 0 }; int status; if ((host == NULL) || (address == NULL)) return (EINVAL); - ai_hints.ai_flags = AI_ADDRCONFIG; - /* XXX: libmodbus can only handle IPv4 addresses. */ - ai_hints.ai_family = AF_INET; - ai_hints.ai_addr = NULL; - ai_hints.ai_canonname = NULL; - ai_hints.ai_next = NULL; - ai_list = NULL; + + struct addrinfo ai_hints = { + /* XXX: libmodbus can only handle IPv4 addresses. */ + .ai_family = AF_INET, + .ai_flags = AI_ADDRCONFIG + }; + status = getaddrinfo (address, /* service = */ NULL, &ai_hints, &ai_list); if (status != 0) diff --git a/src/network.c b/src/network.c index baeb9159..11c39a78 100644 --- a/src/network.c +++ b/src/network.c @@ -2139,7 +2139,6 @@ static int sockent_client_connect (sockent_t *se) /* {{{ */ static c_complain_t complaint = C_COMPLAIN_INIT_STATIC; struct sockent_client *client; - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_list = NULL, *ai_ptr; int status; _Bool reconnect = 0; @@ -2160,10 +2159,12 @@ static int sockent_client_connect (sockent_t *se) /* {{{ */ if (client->fd >= 0 && !reconnect) /* already connected and not stale*/ return (0); - ai_hints.ai_flags = AI_ADDRCONFIG; - ai_hints.ai_family = AF_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 + }; status = getaddrinfo (se->node, (se->service != NULL) ? se->service : NET_DEFAULT_PORT, @@ -2234,7 +2235,6 @@ static int sockent_client_connect (sockent_t *se) /* {{{ */ /* Open the file descriptors for a initialized sockent structure. */ static int sockent_server_listen (sockent_t *se) /* {{{ */ { - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_list, *ai_ptr; int status; @@ -2256,10 +2256,12 @@ static int sockent_server_listen (sockent_t *se) /* {{{ */ DEBUG ("network plugin: sockent_server_listen: node = %s; service = %s;", node, service); - ai_hints.ai_flags = AI_ADDRCONFIG | AI_PASSIVE; - ai_hints.ai_family = AF_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_PASSIVE, + .ai_protocol = IPPROTO_UDP, + .ai_socktype = SOCK_DGRAM + }; status = getaddrinfo (node, service, &ai_hints, &ai_list); if (status != 0) diff --git a/src/ntpd.c b/src/ntpd.c index f36c5005..e075a208 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -346,7 +346,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,10 +363,12 @@ static int ntpd_connect (void) if (strlen (port) == 0) port = NTPD_DEFAULT_PORT; - ai_hints.ai_flags = AI_ADDRCONFIG; - ai_hints.ai_family = PF_UNSPEC; - ai_hints.ai_socktype = SOCK_DGRAM; - ai_hints.ai_protocol = IPPROTO_UDP; + struct addrinfo ai_hints = { + .ai_family = PF_UNSPEC, + .ai_flags = AI_ADDRCONFIG, + .ai_protocol = IPPROTO_UDP, + .ai_socktype = SOCK_DGRAM + }; if ((status = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0) { diff --git a/src/olsrd.c b/src/olsrd.c index 2a4bf03b..976793fe 100644 --- a/src/olsrd.c +++ b/src/olsrd.c @@ -149,18 +149,20 @@ static size_t strtabsplit (char *string, char **fields, size_t size) /* {{{ */ static FILE *olsrd_connect (void) /* {{{ */ { - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_list, *ai_ptr; int ai_return; FILE *fh; - ai_hints.ai_flags = AI_ADDRCONFIG; - ai_hints.ai_family = PF_UNSPEC; - ai_hints.ai_socktype = SOCK_STREAM; - ai_hints.ai_protocol = IPPROTO_TCP; - ai_list = NULL; + + struct addrinfo ai_hints = { + .ai_family = PF_UNSPEC, + .ai_flags = AI_ADDRCONFIG, + .ai_protocol = IPPROTO_TCP, + .ai_socktype = SOCK_STREAM + }; + ai_return = getaddrinfo (olsrd_get_node (), olsrd_get_service (), &ai_hints, &ai_list); if (ai_return != 0) diff --git a/src/pinba.c b/src/pinba.c index 833fa1b8..6a4ebfcd 100644 --- a/src/pinba.c +++ b/src/pinba.c @@ -352,16 +352,8 @@ static pinba_socket_t *pinba_socket_open (const char *node, /* {{{ */ pinba_socket_t *s; struct addrinfo *ai_list; struct addrinfo *ai_ptr; - struct addrinfo ai_hints = { 0 }; int status; - ai_hints.ai_flags = AI_PASSIVE; - ai_hints.ai_family = AF_UNSPEC; - ai_hints.ai_socktype = SOCK_DGRAM; - ai_hints.ai_addr = NULL; - ai_hints.ai_canonname = NULL; - ai_hints.ai_next = NULL; - if (node == NULL) node = PINBA_DEFAULT_NODE; @@ -369,6 +361,13 @@ static pinba_socket_t *pinba_socket_open (const char *node, /* {{{ */ service = PINBA_DEFAULT_SERVICE; ai_list = NULL; + + struct addrinfo ai_hints = { + .ai_family = AF_UNSPEC, + .ai_flags = AI_PASSIVE, + .ai_socktype = SOCK_DGRAM + }; + status = getaddrinfo (node, service, &ai_hints, &ai_list); if (status != 0) diff --git a/src/statsd.c b/src/statsd.c index 5df072d3..285486d8 100644 --- a/src/statsd.c +++ b/src/statsd.c @@ -500,7 +500,6 @@ static int statsd_network_init (struct pollfd **ret_fds, /* {{{ */ struct pollfd *fds = NULL; size_t fds_num = 0; - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_list = NULL; struct addrinfo *ai_ptr; int status; @@ -509,9 +508,11 @@ static int statsd_network_init (struct pollfd **ret_fds, /* {{{ */ char const *service = (conf_service != NULL) ? conf_service : STATSD_DEFAULT_SERVICE; - ai_hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG; - ai_hints.ai_family = AF_UNSPEC; - ai_hints.ai_socktype = SOCK_DGRAM; + struct addrinfo ai_hints = { + .ai_family = AF_UNSPEC, + .ai_flags = AI_PASSIVE | AI_ADDRCONFIG, + .ai_socktype = SOCK_DGRAM + }; status = getaddrinfo (node, service, &ai_hints, &ai_list); if (status != 0) diff --git a/src/teamspeak2.c b/src/teamspeak2.c index 89578f0e..5d534603 100644 --- a/src/teamspeak2.c +++ b/src/teamspeak2.c @@ -198,7 +198,6 @@ static int tss2_get_socket (FILE **ret_read_fh, FILE **ret_write_fh) * Returns connected file objects or establishes the connection * if it's not already present */ - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_head; struct addrinfo *ai_ptr; int sd = -1; @@ -216,9 +215,11 @@ static int tss2_get_socket (FILE **ret_read_fh, FILE **ret_write_fh) } /* Get all addrs for this hostname */ - ai_hints.ai_flags = AI_ADDRCONFIG; - ai_hints.ai_family = AF_UNSPEC; - ai_hints.ai_socktype = SOCK_STREAM; + struct addrinfo ai_hints = { + .ai_family = AF_UNSPEC, + .ai_flags = AI_ADDRCONFIG, + .ai_socktype = SOCK_STREAM + }; status = getaddrinfo ((config_host != NULL) ? config_host : DEFAULT_HOST, (config_port != NULL) ? config_port : DEFAULT_PORT, diff --git a/src/write_graphite.c b/src/write_graphite.c index a22a2365..efdd4d8a 100644 --- a/src/write_graphite.c +++ b/src/write_graphite.c @@ -193,7 +193,6 @@ static int wg_flush_nolock (cdtime_t timeout, struct wg_callback *cb) static int wg_callback_init (struct wg_callback *cb) { - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_list; struct addrinfo *ai_ptr; cdtime_t now; @@ -211,8 +210,10 @@ static int wg_callback_init (struct wg_callback *cb) return (EAGAIN); cb->last_connect_time = now; - ai_hints.ai_flags = AI_ADDRCONFIG; - ai_hints.ai_family = AF_UNSPEC; + struct addrinfo ai_hints = { + .ai_family = AF_UNSPEC, + .ai_flags = AI_ADDRCONFIG + }; if (0 == strcasecmp ("tcp", cb->protocol)) ai_hints.ai_socktype = SOCK_STREAM; diff --git a/src/write_sensu.c b/src/write_sensu.c index 99fca173..63c6d998 100644 --- a/src/write_sensu.c +++ b/src/write_sensu.c @@ -104,23 +104,25 @@ static void free_str_list(struct str_list *strs) /* {{{ */ static int sensu_connect(struct sensu_host *host) /* {{{ */ { int e; - struct addrinfo *ai, hints; + struct addrinfo *ai; char const *node; char const *service; // Resolve the target if we haven't done already if (!(host->flags & F_READY)) { - memset(&hints, 0, sizeof(hints)); memset(&service, 0, sizeof(service)); host->res = NULL; - hints.ai_family = AF_INET; - hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = AI_ADDRCONFIG; node = (host->node != NULL) ? host->node : SENSU_HOST; service = (host->service != NULL) ? host->service : SENSU_PORT; - if ((e = getaddrinfo(node, service, &hints, &(host->res))) != 0) { + struct addrinfo ai_hints = { + .ai_family = AF_INET, + .ai_flags = AI_ADDRCONFIG, + .ai_socktype = SOCK_STREAM + }; + + if ((e = getaddrinfo(node, service, &ai_hints, &(host->res))) != 0) { ERROR("write_sensu plugin: Unable to resolve host \"%s\": %s", node, gai_strerror(e)); return -1; diff --git a/src/write_tsdb.c b/src/write_tsdb.c index 7a8f851f..fe418cf9 100644 --- a/src/write_tsdb.c +++ b/src/write_tsdb.c @@ -155,7 +155,6 @@ static int wt_flush_nolock(cdtime_t timeout, struct wt_callback *cb) static int wt_callback_init(struct wt_callback *cb) { - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai_list; struct addrinfo *ai_ptr; int status; @@ -166,12 +165,14 @@ static int wt_callback_init(struct wt_callback *cb) if (cb->sock_fd > 0) return 0; - ai_hints.ai_flags = AI_ADDRCONFIG; - ai_hints.ai_family = AF_UNSPEC; - ai_hints.ai_socktype = SOCK_STREAM; - ai_list = NULL; + struct addrinfo ai_hints = { + .ai_family = AF_UNSPEC, + .ai_flags = AI_ADDRCONFIG, + .ai_socktype = SOCK_STREAM + }; + status = getaddrinfo(node, service, &ai_hints, &ai_list); if (status != 0) { diff --git a/src/zookeeper.c b/src/zookeeper.c index a236c8ae..a3b73628 100644 --- a/src/zookeeper.c +++ b/src/zookeeper.c @@ -105,17 +105,19 @@ static int zookeeper_connect (void) { int sk = -1; int status; - struct addrinfo ai_hints = { 0 }; struct addrinfo *ai; struct addrinfo *ai_list; const char *host; const char *port; - 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) { -- 2.11.0