From: Sebastian Harl Date: Tue, 26 Aug 2008 09:52:53 +0000 (+0200) Subject: perl plugin: Re-get the perl interpreter after parsing each configuration option. X-Git-Tag: collectd-4.3.4~2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=b90ad9b5b6d928a211b939dc0d51aa92cd09fdd2;p=collectd.git perl plugin: Re-get the perl interpreter after parsing each configuration option. The current perl interpreter might change while parsing the configuration (e.g. the first interpreter is created by the "LoadPlugin" option), so this is to make sure that we're using the right interpreter at all times. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- diff --git a/src/perl.c b/src/perl.c index 9cbd5937..8061e0bf 100644 --- a/src/perl.c +++ b/src/perl.c @@ -1559,16 +1559,14 @@ static int perl_config (oconfig_item_t *ci) { 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; + 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"))