projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'github/pr/2398'
[collectd.git]
/
src
/
perl.c
diff --git
a/src/perl.c
b/src/perl.c
index
e922bad
..
d2a00bf
100644
(file)
--- a/
src/perl.c
+++ b/
src/perl.c
@@
-424,8
+424,6
@@
static int hv2value_list(pTHX_ HV *hash, value_list_t *vl) {
if (NULL != (tmp = hv_fetch(hash, "host", 4, 0)))
sstrncpy(vl->host, SvPV_nolen(*tmp), sizeof(vl->host));
if (NULL != (tmp = hv_fetch(hash, "host", 4, 0)))
sstrncpy(vl->host, SvPV_nolen(*tmp), sizeof(vl->host));
- else
- sstrncpy(vl->host, hostname_g, sizeof(vl->host));
if (NULL != (tmp = hv_fetch(hash, "plugin", 6, 0)))
sstrncpy(vl->plugin, SvPV_nolen(*tmp), sizeof(vl->plugin));
if (NULL != (tmp = hv_fetch(hash, "plugin", 6, 0)))
sstrncpy(vl->plugin, SvPV_nolen(*tmp), sizeof(vl->plugin));
@@
-494,7
+492,8
@@
static int av2data_set(pTHX_ AV *array, char *name, data_set_t *ds) {
* meta => [ { name => <name>, value => <value> }, ... ]
* }
*/
* meta => [ { name => <name>, value => <value> }, ... ]
* }
*/
-static int av2notification_meta(pTHX_ AV *array, notification_meta_t **ret_meta) {
+static int av2notification_meta(pTHX_ AV *array,
+ notification_meta_t **ret_meta) {
notification_meta_t *tail = NULL;
int len = av_len(array);
notification_meta_t *tail = NULL;
int len = av_len(array);
@@
-881,9
+880,9
@@
static int oconfig_item2hv(pTHX_ oconfig_item_t *ci, HV *hash) {
static char *get_module_name(char *buf, size_t buf_len, const char *module) {
int status = 0;
if (base_name[0] == '\0')
static char *get_module_name(char *buf, size_t buf_len, const char *module) {
int status = 0;
if (base_name[0] == '\0')
- status = s
s
nprintf(buf, buf_len, "%s", module);
+ status = snprintf(buf, buf_len, "%s", module);
else
else
- status = s
s
nprintf(buf, buf_len, "%s::%s", base_name, module);
+ status = snprintf(buf, buf_len, "%s::%s", base_name, module);
if ((status < 0) || ((unsigned int)status >= buf_len))
return NULL;
return buf;
if ((status < 0) || ((unsigned int)status >= buf_len))
return NULL;
return buf;
@@
-1625,18
+1624,19
@@
static void _plugin_register_generic_userdata(pTHX, int type,
ret = plugin_register_flush("perl", perl_flush, /* user_data = */ NULL);
}
ret = plugin_register_flush("perl", perl_flush, /* user_data = */ NULL);
}
- if (0 == ret)
+ if (0 == ret)
{
ret = plugin_register_flush(pluginname, perl_flush, &userdata);
ret = plugin_register_flush(pluginname, perl_flush, &userdata);
+ } else {
+ free(userdata.data);
+ }
} else {
ret = -1;
}
if (0 == ret)
XSRETURN_YES;
} else {
ret = -1;
}
if (0 == ret)
XSRETURN_YES;
- else {
- free(userdata.data);
+ else
XSRETURN_EMPTY;
XSRETURN_EMPTY;
- }
} /* static void _plugin_register_generic_userdata ( ... ) */
/*
} /* static void _plugin_register_generic_userdata ( ... ) */
/*
@@
-2616,6
+2616,12
@@
static int perl_config_plugin(pTHX_ oconfig_item_t *ci) {
char *plugin;
HV *config;
char *plugin;
HV *config;
+ if (NULL == perl_threads) {
+ log_err("A `Plugin' block was encountered but no plugin was loaded yet. "
+ "Put the appropriate `LoadPlugin' option in front of it.");
+ return -1;
+ }
+
dSP;
if ((1 != ci->values_num) || (OCONFIG_TYPE_STRING != ci->values[0].type)) {
dSP;
if ((1 != ci->values_num) || (OCONFIG_TYPE_STRING != ci->values[0].type)) {