X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fapcups.c;h=cc2035787ea8fb1a595ad4a0ba9e2e52fabef50e;hb=43954e07f30d05b2da8319749400c9bf4d01c23c;hp=9f7476bfa929940bf4bf882bfc01da764b476633;hpb=baad654e3013127e600d732adbf4e45804282bb5;p=collectd.git diff --git a/src/apcups.c b/src/apcups.c index 9f7476bf..cc203578 100644 --- a/src/apcups.c +++ b/src/apcups.c @@ -25,6 +25,7 @@ **/ #include "collectd.h" + #include "common.h" /* rrd_update_file */ #include "plugin.h" /* plugin_register, plugin_submit */ #include "configfile.h" /* cf_register */ @@ -115,15 +116,14 @@ static int net_open (char const *node, char const *service) { int sd; int status; - struct addrinfo ai_hints; struct addrinfo *ai_return; struct addrinfo *ai_list; - /* Resolve name */ - memset (&ai_hints, 0, sizeof (ai_hints)); /* 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) @@ -381,10 +381,9 @@ static int apc_query_server (char const *node, char const *service, static int apcups_config (oconfig_item_t *ci) { - int i; _Bool persistent_conn_set = 0; - for (i = 0; i < ci->children_num; i++) + for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i;