projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'collectd-5.5' into collectd-5.6
[collectd.git]
/
src
/
collectd-tg.c
diff --git
a/src/collectd-tg.c
b/src/collectd-tg.c
index
05cf9a7
..
7db9fe7
100644
(file)
--- a/
src/collectd-tg.c
+++ b/
src/collectd-tg.c
@@
-40,12
+40,12
@@
#include <signal.h>
#include <errno.h>
#include <math.h>
#include <signal.h>
#include <errno.h>
#include <math.h>
+#include <sys/time.h>
#include "utils_heap.h"
#include "libcollectdclient/collectd/client.h"
#include "libcollectdclient/collectd/network.h"
#include "utils_heap.h"
#include "libcollectdclient/collectd/client.h"
#include "libcollectdclient/collectd/network.h"
-#include "libcollectdclient/collectd/network_buffer.h"
#define DEF_NUM_HOSTS 1000
#define DEF_NUM_PLUGINS 20
#define DEF_NUM_HOSTS 1000
#define DEF_NUM_PLUGINS 20
@@
-155,13
+155,12
@@
static lcc_value_list_t *create_value_list (void) /* {{{ */
lcc_value_list_t *vl;
int host_num;
lcc_value_list_t *vl;
int host_num;
- vl =
malloc (
sizeof (*vl));
+ vl =
calloc (1,
sizeof (*vl));
if (vl == NULL)
{
if (vl == NULL)
{
- fprintf (stderr, "
m
alloc failed.\n");
+ fprintf (stderr, "
c
alloc failed.\n");
return (NULL);
}
return (NULL);
}
- memset (vl, 0, sizeof (*vl));
vl->values = calloc (/* nmemb = */ 1, sizeof (*vl->values));
if (vl->values == NULL)
vl->values = calloc (/* nmemb = */ 1, sizeof (*vl->values));
if (vl->values == NULL)
@@
-200,6
+199,7
@@
static lcc_value_list_t *create_value_list (void) /* {{{ */
strncpy (vl->identifier.type,
(vl->values_types[0] == LCC_TYPE_GAUGE) ? "gauge" : "derive",
sizeof (vl->identifier.type));
strncpy (vl->identifier.type,
(vl->values_types[0] == LCC_TYPE_GAUGE) ? "gauge" : "derive",
sizeof (vl->identifier.type));
+ vl->identifier.type[sizeof (vl->identifier.type) - 1] = 0;
snprintf (vl->identifier.type_instance, sizeof (vl->identifier.type_instance),
"ti%li", random ());
snprintf (vl->identifier.type_instance, sizeof (vl->identifier.type_instance),
"ti%li", random ());
@@
-337,7
+337,6
@@
static int read_options (int argc, char **argv) /* {{{ */
int main (int argc, char **argv) /* {{{ */
{
int main (int argc, char **argv) /* {{{ */
{
- int i;
double last_time;
int values_sent = 0;
double last_time;
int values_sent = 0;
@@
-366,7
+365,7
@@
int main (int argc, char **argv) /* {{{ */
else
{
lcc_server_t *srv;
else
{
lcc_server_t *srv;
-
+
srv = lcc_server_create (net, conf_destination, conf_service);
if (srv == NULL)
{
srv = lcc_server_create (net, conf_destination, conf_service);
if (srv == NULL)
{
@@
-383,7
+382,7
@@
int main (int argc, char **argv) /* {{{ */
fprintf (stdout, "Creating %i values ... ", conf_num_values);
fflush (stdout);
fprintf (stdout, "Creating %i values ... ", conf_num_values);
fflush (stdout);
- for (i = 0; i < conf_num_values; i++)
+ for (i
nt i
= 0; i < conf_num_values; i++)
{
lcc_value_list_t *vl;
{
lcc_value_list_t *vl;
@@
-450,7
+449,6
@@
int main (int argc, char **argv) /* {{{ */
lcc_network_destroy (net);
exit (EXIT_SUCCESS);
lcc_network_destroy (net);
exit (EXIT_SUCCESS);
- return (0);
} /* }}} int main */
/* vim: set sw=2 sts=2 et fdm=marker : */
} /* }}} int main */
/* vim: set sw=2 sts=2 et fdm=marker : */