X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fipvs.c;h=38e464107bd7e79deabe31cff82719007d7753e9;hb=1b4d95b869063e619bd7aae54cf37c5a1b91fbee;hp=ab76f1eb8638d2517dd1e56ddb981148d17ed556;hpb=6bd4bf7b21f84746010792b885b9b71791dccb79;p=collectd.git diff --git a/src/ipvs.c b/src/ipvs.c index ab76f1eb..38e46410 100644 --- a/src/ipvs.c +++ b/src/ipvs.c @@ -45,7 +45,9 @@ #endif /* HAVE_NETINET_IN_H */ /* this can probably only be found in the kernel sources */ -#if HAVE_NET_IP_VS_H +#if HAVE_LINUX_IP_VS_H +# include +#elif HAVE_NET_IP_VS_H # include #elif HAVE_IP_VS_H # include @@ -195,7 +197,7 @@ static int get_pi (struct ip_vs_service_entry *se, char *pi, size_t size) (se->protocol == IPPROTO_TCP) ? "TCP" : "UDP", ntohs (se->port)); - if ((0 > len) || (size <= len)) { + if ((0 > len) || (size <= ((size_t) len))) { log_err ("plugin instance truncated: %s", pi); return -1; } @@ -218,7 +220,7 @@ static int get_ti (struct ip_vs_dest_entry *de, char *ti, size_t size) len = ssnprintf (ti, size, "%s_%u", inet_ntoa (addr), ntohs (de->port)); - if ((0 > len) || (size <= len)) { + if ((0 > len) || (size <= ((size_t) len))) { log_err ("type instance truncated: %s", ti); return -1; } @@ -290,10 +292,13 @@ static void cipvs_submit_service (struct ip_vs_service_entry *se) char pi[DATA_MAX_NAME_LEN]; - int i = 0; + size_t i; if (0 != get_pi (se, pi, sizeof (pi))) + { + free (dests); return; + } cipvs_submit_connections (pi, NULL, stats.conns); cipvs_submit_if (pi, "if_packets", NULL, stats.inpkts, stats.outpkts); @@ -309,7 +314,7 @@ static void cipvs_submit_service (struct ip_vs_service_entry *se) static int cipvs_read (void) { struct ip_vs_get_services *services = NULL; - int i = 0; + size_t i; if (sockfd < 0) return (-1);