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 #3353 from mrunge/master
[collectd.git]
/
src
/
hddtemp.c
diff --git
a/src/hddtemp.c
b/src/hddtemp.c
index
a7eaf36
..
96b4f0c
100644
(file)
--- a/
src/hddtemp.c
+++ b/
src/hddtemp.c
@@
-33,8
+33,8
@@
#include "collectd.h"
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
+#include "utils/common/common.h"
#include <assert.h>
#include <libgen.h> /* for basename */
#include <assert.h>
#include <libgen.h> /* for basename */
@@
-53,7
+53,7
@@
static const char *config_keys[] = {"Host", "Port"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
static const char *config_keys[] = {"Host", "Port"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
-static char *hddtemp_host
= NULL
;
+static char *hddtemp_host;
static char hddtemp_port[16];
/*
static char hddtemp_port[16];
/*
@@
-108,10
+108,8
@@
static char *hddtemp_query_daemon(void) {
.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("hddtemp plugin: getaddrinfo (%s, %s): %s", host, port,
ERROR("hddtemp plugin: 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 NULL;
}
return NULL;
}
@@
-121,17
+119,13
@@
static char *hddtemp_query_daemon(void) {
/* create our socket descriptor */
fd = socket(ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol);
if (fd < 0) {
/* create our socket descriptor */
fd = socket(ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol);
if (fd < 0) {
- char errbuf[1024];
- ERROR("hddtemp plugin: socket: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("hddtemp plugin: socket: %s", STRERRNO);
continue;
}
/* connect to the hddtemp daemon */
if (connect(fd, (struct sockaddr *)ai_ptr->ai_addr, ai_ptr->ai_addrlen)) {
continue;
}
/* connect to the hddtemp daemon */
if (connect(fd, (struct sockaddr *)ai_ptr->ai_addr, ai_ptr->ai_addrlen)) {
- char errbuf[1024];
- INFO("hddtemp plugin: connect (%s, %s) failed: %s", host, port,
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ INFO("hddtemp plugin: connect (%s, %s) failed: %s", host, port, STRERRNO);
close(fd);
fd = -1;
continue;
close(fd);
fd = -1;
continue;
@@
-177,13
+171,11
@@
static char *hddtemp_query_daemon(void) {
if (status == 0) {
break;
} else if (status == -1) {
if (status == 0) {
break;
} else if (status == -1) {
- char errbuf[1024];
if ((errno == EAGAIN) || (errno == EINTR))
continue;
if ((errno == EAGAIN) || (errno == EINTR))
continue;
- ERROR("hddtemp plugin: Error reading from socket: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("hddtemp plugin: Error reading from socket: %s", STRERRNO);
close(fd);
free(buffer);
return NULL;
close(fd);
free(buffer);
return NULL;