X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fipvs.c;h=0259df80fa011c389df2a70c3f2be2250dcf5cb6;hb=c4439c9cb3e2348ad7013644731de27a55eca478;hp=f747cb0765a398117494de26886e54b8fb64f6d7;hpb=be126043c2be20399d7670fe194645292018bde0;p=collectd.git diff --git a/src/ipvs.c b/src/ipvs.c index f747cb07..0259df80 100644 --- a/src/ipvs.c +++ b/src/ipvs.c @@ -32,8 +32,8 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" +#include "utils/common/common.h" #if HAVE_ARPA_INET_H #include @@ -63,9 +63,7 @@ static struct ip_vs_get_services *ipvs_get_services(void) { if (getsockopt(sockfd, IPPROTO_IP, IP_VS_SO_GET_INFO, &ipvs_info, &len) == -1) { - char errbuf[1024]; - log_err("ip_vs_get_services: getsockopt() failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + log_err("ip_vs_get_services: getsockopt() failed: %s", STRERRNO); return NULL; } @@ -82,9 +80,7 @@ static struct ip_vs_get_services *ipvs_get_services(void) { if (getsockopt(sockfd, IPPROTO_IP, IP_VS_SO_GET_SERVICES, services, &len) == -1) { - char errbuf[1024]; - log_err("ipvs_get_services: getsockopt failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + log_err("ipvs_get_services: getsockopt failed: %s", STRERRNO); free(services); return NULL; @@ -111,9 +107,7 @@ static struct ip_vs_get_dests *ipvs_get_dests(struct ip_vs_service_entry *se) { dests->num_dests = se->num_dests; if (getsockopt(sockfd, IPPROTO_IP, IP_VS_SO_GET_DESTS, dests, &len) == -1) { - char errbuf[1024]; - log_err("ipvs_get_dests: getsockopt() failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + log_err("ipvs_get_dests: getsockopt() failed: %s", STRERRNO); free(dests); return NULL; } @@ -127,9 +121,7 @@ static int cipvs_init(void) { struct ip_vs_getinfo ipvs_info; if ((sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) == -1) { - char errbuf[1024]; - log_err("cipvs_init: socket() failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + log_err("cipvs_init: socket() failed: %s", STRERRNO); return -1; } @@ -137,9 +129,7 @@ static int cipvs_init(void) { if (getsockopt(sockfd, IPPROTO_IP, IP_VS_SO_GET_INFO, &ipvs_info, &len) == -1) { - char errbuf[1024]; - log_err("cipvs_init: getsockopt() failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + log_err("cipvs_init: getsockopt() failed: %s", STRERRNO); close(sockfd); sockfd = -1; return -1; @@ -173,7 +163,7 @@ static int get_pi(struct ip_vs_service_entry *se, char *pi, size_t size) { int len = snprintf(pi, size, "%s_%s%u", inet_ntoa(addr), - (se->protocol == IPPROTO_TCP) ? "TCP" : "UDP", ntohs(se->port)); + (se->protocol == IPPROTO_TCP) ? "TCP" : "UDP", ntohs(se->port)); if ((len < 0) || (size <= ((size_t)len))) { log_err("plugin instance truncated: %s", pi);