projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
contrib/php-collection: Add a PHP frontend for graph generation.
[collectd.git]
/
src
/
perl.c
diff --git
a/src/perl.c
b/src/perl.c
index
2bd03af
..
3df11a3
100644
(file)
--- a/
src/perl.c
+++ b/
src/perl.c
@@
-27,13
+27,19
@@
/* do not automatically get the thread specific perl interpreter */
#define PERL_NO_GET_CONTEXT
/* do not automatically get the thread specific perl interpreter */
#define PERL_NO_GET_CONTEXT
+#define DONT_POISON_SPRINTF_YET 1
#include "collectd.h"
#include "collectd.h"
+#undef DONT_POISON_SPRINTF_YET
#include "configfile.h"
#include <EXTERN.h>
#include <perl.h>
#include "configfile.h"
#include <EXTERN.h>
#include <perl.h>
+#if defined(COLLECT_DEBUG) && COLLECT_DEBUG && defined(__GNUC__) && __GNUC__
+# pragma GCC poison sprintf
+#endif
+
#include <XSUB.h>
/* Some versions of Perl define their own version of DEBUG... :-/ */
#include <XSUB.h>
/* Some versions of Perl define their own version of DEBUG... :-/ */
@@
-559,7
+565,7
@@
static int pplugin_dispatch_values (pTHX_ char *name, HV *values)
list.host[DATA_MAX_NAME_LEN - 1] = '\0';
}
else {
list.host[DATA_MAX_NAME_LEN - 1] = '\0';
}
else {
- s
trcpy (list.host, hostname_g
);
+ s
strncpy (list.host, hostname_g, sizeof (list.host)
);
}
if (NULL != (tmp = hv_fetch (values, "plugin", 6, 0))) {
}
if (NULL != (tmp = hv_fetch (values, "plugin", 6, 0))) {
@@
-1475,7
+1481,9
@@
static int init_pi (int argc, char **argv)
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
if (0 != perl_parse (aTHX_ xs_init, argc, argv, NULL)) {
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
if (0 != perl_parse (aTHX_ xs_init, argc, argv, NULL)) {
- log_err ("init_pi: Unable to bootstrap Collectd.");
+ SV *err = get_sv ("@", 1);
+ log_err ("init_pi: Unable to bootstrap Collectd: %s",
+ SvPV_nolen (err));
perl_destruct (perl_threads->head->interp);
perl_free (perl_threads->head->interp);
perl_destruct (perl_threads->head->interp);
perl_free (perl_threads->head->interp);
@@
-1642,16
+1650,14
@@
static int perl_config (oconfig_item_t *ci)
{
int i = 0;
{
int i = 0;
- dTHX;
-
- /* dTHX does not get any valid values in case Perl
- * has not been initialized */
- if (NULL == perl_threads)
- aTHX = NULL;
+ dTHXa (NULL);
for (i = 0; i < ci->children_num; ++i) {
oconfig_item_t *c = ci->children + i;
for (i = 0; i < ci->children_num; ++i) {
oconfig_item_t *c = ci->children + i;
+ if (NULL != perl_threads)
+ aTHX = PERL_GET_CONTEXT;
+
if (0 == strcasecmp (c->key, "LoadPlugin"))
perl_config_loadplugin (aTHX_ c);
else if (0 == strcasecmp (c->key, "BaseName"))
if (0 == strcasecmp (c->key, "LoadPlugin"))
perl_config_loadplugin (aTHX_ c);
else if (0 == strcasecmp (c->key, "BaseName"))