X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fipvs.c;h=4345a46532237081bcd8ff075102e6d34635f4a7;hb=124f321bbbf0d27fe2b3e5bcb53773fc1686e133;hp=ab76f1eb8638d2517dd1e56ddb981148d17ed556;hpb=488c2ca9e3f6f6082f192bdd5d737c6cd1298ba2;p=collectd.git diff --git a/src/ipvs.c b/src/ipvs.c index ab76f1eb..4345a465 100644 --- a/src/ipvs.c +++ b/src/ipvs.c @@ -37,15 +37,14 @@ #if HAVE_ARPA_INET_H # include #endif /* HAVE_ARPA_INET_H */ -#if HAVE_SYS_SOCKET_H -# include -#endif /* HAVE_SYS_SOCKET_H */ #if HAVE_NETINET_IN_H # include #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 +194,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 +217,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 +289,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 +311,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);