projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
write_http plugin: Be extra conservative in wh_reset_buffer().
[collectd.git]
/
src
/
mbmon.c
diff --git
a/src/mbmon.c
b/src/mbmon.c
index
d23062d
..
2e26aa1
100644
(file)
--- a/
src/mbmon.c
+++ b/
src/mbmon.c
@@
-24,12
+24,12
@@
**/
#include "collectd.h"
**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "configfile.h"
#include <netdb.h>
#include "common.h"
#include "plugin.h"
#include "configfile.h"
#include <netdb.h>
-#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@
-85,19
+85,9
@@
static int mbmon_query_daemon (char *buffer, int buffer_size)
const char *host;
const char *port;
const char *host;
const char *port;
- struct addrinfo ai_hints;
struct addrinfo *ai_list, *ai_ptr;
int ai_return;
struct addrinfo *ai_list, *ai_ptr;
int ai_return;
- memset (&ai_hints, '\0', sizeof (ai_hints));
- ai_hints.ai_flags = 0;
-#ifdef AI_ADDRCONFIG
- ai_hints.ai_flags |= AI_ADDRCONFIG;
-#endif
- ai_hints.ai_family = PF_UNSPEC;
- ai_hints.ai_socktype = SOCK_STREAM;
- ai_hints.ai_protocol = IPPROTO_TCP;
-
host = mbmon_host;
if (host == NULL)
host = MBMON_DEF_HOST;
host = mbmon_host;
if (host == NULL)
host = MBMON_DEF_HOST;
@@
-106,6
+96,13
@@
static int mbmon_query_daemon (char *buffer, int buffer_size)
if (port == NULL)
port = MBMON_DEF_PORT;
if (port == NULL)
port = MBMON_DEF_PORT;
+ struct addrinfo ai_hints = {
+ .ai_family = AF_UNSPEC,
+ .ai_flags = AI_ADDRCONFIG,
+ .ai_protocol = IPPROTO_TCP,
+ .ai_socktype = SOCK_STREAM
+ };
+
if ((ai_return = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0)
{
char errbuf[1024];
if ((ai_return = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0)
{
char errbuf[1024];
@@
-261,8
+258,8
@@
static int mbmon_read (void)
double value;
char *nextc;
double value;
char *nextc;
- char *type;
- char *inst;
+ c
onst c
har *type;
+ c
onst c
har *inst;
*t++ = '\0';
trim_spaces (s);
*t++ = '\0';
trim_spaces (s);