projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
all plugins: remove pthread.h include
[collectd.git]
/
src
/
tail.c
diff --git
a/src/tail.c
b/src/tail.c
index
3904f1b
..
5402f66
100644
(file)
--- a/
src/tail.c
+++ b/
src/tail.c
@@
-56,9
+56,9
@@
struct ctail_config_match_s
};
typedef struct ctail_config_match_s ctail_config_match_t;
};
typedef struct ctail_config_match_s ctail_config_match_t;
-cu_tail_match_t **tail_match_list = NULL;
-size_t tail_match_list_num = 0;
-cdtime_t tail_match_list_intervals[255];
+
static
cu_tail_match_t **tail_match_list = NULL;
+s
tatic s
ize_t tail_match_list_num = 0;
+
static
cdtime_t tail_match_list_intervals[255];
static int ctail_config_add_match_dstype (ctail_config_match_t *cm,
oconfig_item_t *ci)
static int ctail_config_add_match_dstype (ctail_config_match_t *cm,
oconfig_item_t *ci)
@@
-236,7
+236,7
@@
static int ctail_config_add_file (oconfig_item_t *ci)
if (tm == NULL)
{
ERROR ("tail plugin: tail_match_create (%s) failed.",
if (tm == NULL)
{
ERROR ("tail plugin: tail_match_create (%s) failed.",
- ci->values[0].value.string);
+
ci->values[0].value.string);
return (-1);
}
return (-1);
}
@@
-253,7
+253,7
@@
static int ctail_config_add_file (oconfig_item_t *ci)
{
status = ctail_config_add_match (tm, plugin_instance, option, interval);
if (status == 0)
{
status = ctail_config_add_match (tm, plugin_instance, option, interval);
if (status == 0)
- num_matches++;
+
num_matches++;
/* Be mild with failed matches.. */
status = 0;
}
/* Be mild with failed matches.. */
status = 0;
}
@@
-266,10
+266,12
@@
static int ctail_config_add_file (oconfig_item_t *ci)
break;
} /* for (i = 0; i < ci->children_num; i++) */
break;
} /* for (i = 0; i < ci->children_num; i++) */
+ sfree (plugin_instance);
+
if (num_matches == 0)
{
ERROR ("tail plugin: No (valid) matches found for file `%s'.",
if (num_matches == 0)
{
ERROR ("tail plugin: No (valid) matches found for file `%s'.",
- ci->values[0].value.string);
+
ci->values[0].value.string);
tail_match_destroy (tm);
return (-1);
}
tail_match_destroy (tm);
return (-1);
}
@@
-277,8
+279,8
@@
static int ctail_config_add_file (oconfig_item_t *ci)
{
cu_tail_match_t **temp;
{
cu_tail_match_t **temp;
- temp =
(cu_tail_match_t **)
realloc (tail_match_list,
- sizeof (cu_tail_match_t *) * (tail_match_list_num + 1));
+ temp = realloc (tail_match_list,
+
sizeof (cu_tail_match_t *) * (tail_match_list_num + 1));
if (temp == NULL)
{
ERROR ("tail plugin: realloc failed.");
if (temp == NULL)
{
ERROR ("tail plugin: realloc failed.");
@@
-330,7
+332,6
@@
static int ctail_read (user_data_t *ud)
static int ctail_init (void)
{
static int ctail_init (void)
{
- struct timespec cb_interval;
char str[255];
user_data_t ud;
size_t i;
char str[255];
user_data_t ud;
size_t i;
@@
-347,8
+348,7
@@
static int ctail_init (void)
{
ud.data = (void *)tail_match_list[i];
ssnprintf(str, sizeof(str), "tail-%zu", i);
{
ud.data = (void *)tail_match_list[i];
ssnprintf(str, sizeof(str), "tail-%zu", i);
- CDTIME_T_TO_TIMESPEC (tail_match_list_intervals[i], &cb_interval);
- plugin_register_complex_read (NULL, str, ctail_read, &cb_interval, &ud);
+ plugin_register_complex_read (NULL, str, ctail_read, tail_match_list_intervals[i], &ud);
}
return (0);
}
return (0);