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)
{
{
/* 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)
{
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);