projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1856 from rubenk/snmp-dont-dispatch-values-with-empty-type-instance
[collectd.git]
/
src
/
zookeeper.c
diff --git
a/src/zookeeper.c
b/src/zookeeper.c
index
a90d355
..
8417485
100644
(file)
--- a/
src/zookeeper.c
+++ b/
src/zookeeper.c
@@
-106,17
+106,18
@@
static int zookeeper_connect (void)
{
int sk = -1;
int status;
{
int sk = -1;
int status;
- struct addrinfo ai_hints = { 0 };
- struct addrinfo *ai;
struct addrinfo *ai_list;
const char *host;
const char *port;
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;
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)
{
status = getaddrinfo (host, port, &ai_hints, &ai_list);
if (status != 0)
{
@@
-128,7
+129,7
@@
static int zookeeper_connect (void)
return (-1);
}
return (-1);
}
- for (ai = ai_list; ai != NULL; ai = ai->ai_next)
+ for (
struct addrinfo *
ai = ai_list; ai != NULL; ai = ai->ai_next)
{
sk = socket (ai->ai_family, SOCK_STREAM, 0);
if (sk < 0)
{
sk = socket (ai->ai_family, SOCK_STREAM, 0);
if (sk < 0)