X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Folsrd.c;h=c8b8b7a96e311c569ce8c4b24fb3611d90aa08b5;hp=0e290ad89323a3ef32b6bb1b4485c0db7bae6780;hb=54619dc85fd308b21ed09a0271e5c7383c7921b9;hpb=be126043c2be20399d7670fe194645292018bde0 diff --git a/src/olsrd.c b/src/olsrd.c index 0e290ad8..c8b8b7a9 100644 --- a/src/olsrd.c +++ b/src/olsrd.c @@ -26,8 +26,8 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" +#include "utils/common/common.h" #include #include @@ -41,8 +41,8 @@ static const char *config_keys[] = {"Host", "Port", "CollectLinks", "CollectRoutes", "CollectTopology"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static char *config_node = NULL; -static char *config_service = NULL; +static char *config_node; +static char *config_service; #define OLSRD_WANT_NOT 0 #define OLSRD_WANT_SUMMARY 1 @@ -162,19 +162,16 @@ static FILE *olsrd_connect(void) /* {{{ */ ai_ptr = ai_ptr->ai_next) { int fd; int status; - char errbuf[1024]; fd = socket(ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol); if (fd < 0) { - ERROR("olsrd plugin: socket failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("olsrd plugin: socket failed: %s", STRERRNO); continue; } status = connect(fd, ai_ptr->ai_addr, ai_ptr->ai_addrlen); if (status != 0) { - ERROR("olsrd plugin: connect failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("olsrd plugin: connect failed: %s", STRERRNO); close(fd); continue; } @@ -295,7 +292,7 @@ static int olsrd_cb_links(int lineno, /* {{{ */ char type_instance[DATA_MAX_NAME_LEN]; snprintf(type_instance, sizeof(type_instance), "%s-%s-lq", fields[0], - fields[1]); + fields[1]); DEBUG("olsrd plugin: links: type_instance = %s; lq = %g;", type_instance, lq); @@ -319,7 +316,7 @@ static int olsrd_cb_links(int lineno, /* {{{ */ char type_instance[DATA_MAX_NAME_LEN]; snprintf(type_instance, sizeof(type_instance), "%s-%s-rx", fields[0], - fields[1]); + fields[1]); DEBUG("olsrd plugin: links: type_instance = %s; nlq = %g;", type_instance, lq); @@ -497,7 +494,7 @@ static int olsrd_cb_topology(int lineno, /* {{{ */ char type_instance[DATA_MAX_NAME_LEN] = {0}; snprintf(type_instance, sizeof(type_instance), "%s-%s-lq", fields[0], - fields[1]); + fields[1]); DEBUG("olsrd plugin: type_instance = %s; lq = %g;", type_instance, lq); olsrd_submit(/* p.-inst = */ "topology", /* type = */ "signal_quality", type_instance, lq); @@ -516,7 +513,7 @@ static int olsrd_cb_topology(int lineno, /* {{{ */ char type_instance[DATA_MAX_NAME_LEN] = {0}; snprintf(type_instance, sizeof(type_instance), "%s-%s-nlq", fields[0], - fields[1]); + fields[1]); DEBUG("olsrd plugin: type_instance = %s; nlq = %g;", type_instance, nlq); olsrd_submit(/* p.-inst = */ "topology", /* type = */ "signal_quality", type_instance, nlq);