X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fchrony.c;h=0485036a132aecf6ca0a9b1dbf11907b03aa809e;hb=727a4b977ec6549d94da3f694bf3fe8b0121db58;hp=4a09753ffc3ee2b3ee151b5841ad670dc6b86e5a;hpb=3fae5596643f1e361eb18c3d65448f8bc02fdd80;p=collectd.git diff --git a/src/chrony.c b/src/chrony.c index 4a09753f..0485036a 100644 --- a/src/chrony.c +++ b/src/chrony.c @@ -26,6 +26,7 @@ */ #include "collectd.h" + #include "common.h" /* auxiliary functions */ #include "plugin.h" /* plugin_register_*, plugin_dispatch_values */ @@ -306,14 +307,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) { @@ -1051,7 +1053,7 @@ chrony_read(void) { /* collectd read callback: Perform data acquisition */ int rc; - unsigned int now_src, n_sources; + unsigned int n_sources; if (g_chrony_seq_is_initialized == 0) { @@ -1073,7 +1075,7 @@ chrony_read(void) if (rc != CHRONY_RC_OK) return rc; - for (now_src = 0; now_src < n_sources; ++now_src) + for (unsigned int now_src = 0; now_src < n_sources; ++now_src) { int is_reachable; rc = chrony_request_source_data(now_src, &is_reachable);