X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fmbmon.c;h=b5352bf6e5d8f4e9c9f8d295eb037e53475075e5;hp=f321c8d09ff5c21b044ec763d4787ecbc55bba53;hb=7111bb6df7628edce3a8e538b386fbe27633a191;hpb=2079ee1517e34de372f58e7e2267ad5c71a8a41f diff --git a/src/mbmon.c b/src/mbmon.c index f321c8d0..b5352bf6 100644 --- a/src/mbmon.c +++ b/src/mbmon.c @@ -99,7 +99,7 @@ static int mbmon_query_daemon(char *buffer, int buffer_size) { ERROR("mbmon: getaddrinfo (%s, %s): %s", host, port, (ai_return == EAI_SYSTEM) ? sstrerror(errno, errbuf, sizeof(errbuf)) : gai_strerror(ai_return)); - return (-1); + return -1; } fd = -1; @@ -132,7 +132,7 @@ static int mbmon_query_daemon(char *buffer, int buffer_size) { if (fd < 0) { ERROR("mbmon: Could not connect to daemon."); - return (-1); + return -1; } /* receive data from the mbmon daemon */ @@ -150,7 +150,7 @@ static int mbmon_query_daemon(char *buffer, int buffer_size) { ERROR("mbmon: Error reading from socket: %s", sstrerror(errno, errbuf, sizeof(errbuf))); close(fd); - return (-1); + return -1; } buffer_fill += status; @@ -166,11 +166,11 @@ static int mbmon_query_daemon(char *buffer, int buffer_size) { "Buffer: `%s'", buffer); close(fd); - return (-1); + return -1; } close(fd); - return (0); + return 0; } static int mbmon_config(const char *key, const char *value) { @@ -183,22 +183,18 @@ static int mbmon_config(const char *key, const char *value) { free(mbmon_port); mbmon_port = strdup(value); } else { - return (-1); + return -1; } - return (0); + return 0; } static void mbmon_submit(const char *type, const char *type_instance, double value) { - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - values[0].gauge = value; - - vl.values = values; + vl.values = &(value_t){.gauge = value}; vl.values_len = 1; - sstrncpy(vl.host, hostname_g, sizeof(vl.host)); sstrncpy(vl.plugin, "mbmon", sizeof(vl.plugin)); sstrncpy(vl.type, type, sizeof(vl.type)); sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance)); @@ -218,7 +214,7 @@ static int mbmon_read(void) { /* get data from daemon */ if (mbmon_query_daemon(buf, sizeof(buf)) < 0) - return (-1); + return -1; s = buf; while ((t = strchr(s, ':')) != NULL) { @@ -258,7 +254,7 @@ static int mbmon_read(void) { s = nextc + 1; } - return (0); + return 0; } /* void mbmon_read */ /* module_register