projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #3178 from ashie/fix-match-regex-for-empty-meta
[collectd.git]
/
src
/
mbmon.c
diff --git
a/src/mbmon.c
b/src/mbmon.c
index
b5352bf
..
50955f3
100644
(file)
--- a/
src/mbmon.c
+++ b/
src/mbmon.c
@@
-25,8
+25,8
@@
#include "collectd.h"
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
+#include "utils/common/common.h"
#include <netdb.h>
#include <netinet/in.h>
#include <netdb.h>
#include <netinet/in.h>
@@
-38,8
+38,8
@@
static const char *config_keys[] = {"Host", "Port", NULL};
static int config_keys_num = 2;
static const char *config_keys[] = {"Host", "Port", NULL};
static int config_keys_num = 2;
-static char *mbmon_host
= NULL
;
-static char *mbmon_port
= NULL
;
+static char *mbmon_host;
+static char *mbmon_port;
/*
* NAME
/*
* NAME
@@
-95,10
+95,8
@@
static int mbmon_query_daemon(char *buffer, int buffer_size) {
.ai_socktype = SOCK_STREAM};
if ((ai_return = getaddrinfo(host, port, &ai_hints, &ai_list)) != 0) {
.ai_socktype = SOCK_STREAM};
if ((ai_return = getaddrinfo(host, port, &ai_hints, &ai_list)) != 0) {
- char errbuf[1024];
ERROR("mbmon: getaddrinfo (%s, %s): %s", host, port,
ERROR("mbmon: getaddrinfo (%s, %s): %s", host, port,
- (ai_return == EAI_SYSTEM) ? sstrerror(errno, errbuf, sizeof(errbuf))
- : gai_strerror(ai_return));
+ (ai_return == EAI_SYSTEM) ? STRERRNO : gai_strerror(ai_return));
return -1;
}
return -1;
}
@@
-108,16
+106,13
@@
static int mbmon_query_daemon(char *buffer, int buffer_size) {
/* create our socket descriptor */
if ((fd = socket(ai_ptr->ai_family, ai_ptr->ai_socktype,
ai_ptr->ai_protocol)) < 0) {
/* create our socket descriptor */
if ((fd = socket(ai_ptr->ai_family, ai_ptr->ai_socktype,
ai_ptr->ai_protocol)) < 0) {
- char errbuf[1024];
- ERROR("mbmon: socket: %s", sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("mbmon: socket: %s", STRERRNO);
continue;
}
/* connect to the mbmon daemon */
if (connect(fd, (struct sockaddr *)ai_ptr->ai_addr, ai_ptr->ai_addrlen)) {
continue;
}
/* connect to the mbmon daemon */
if (connect(fd, (struct sockaddr *)ai_ptr->ai_addr, ai_ptr->ai_addrlen)) {
- char errbuf[1024];
- INFO("mbmon: connect (%s, %s): %s", host, port,
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ INFO("mbmon: connect (%s, %s): %s", host, port, STRERRNO);
close(fd);
fd = -1;
continue;
close(fd);
fd = -1;
continue;
@@
-142,13
+137,11
@@
static int mbmon_query_daemon(char *buffer, int buffer_size) {
while ((status = read(fd, buffer + buffer_fill, buffer_size - buffer_fill)) !=
0) {
if (status == -1) {
while ((status = read(fd, buffer + buffer_fill, buffer_size - buffer_fill)) !=
0) {
if (status == -1) {
- char errbuf[1024];
if ((errno == EAGAIN) || (errno == EINTR))
continue;
if ((errno == EAGAIN) || (errno == EINTR))
continue;
- ERROR("mbmon: Error reading from socket: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("mbmon: Error reading from socket: %s", STRERRNO);
close(fd);
return -1;
}
close(fd);
return -1;
}