[collectd] [PATCH] perl plugin: Fixed the "EnableDebugger after LoadPlugin" warning.

Sebastian Harl sh at tokkee.org
Tue Mar 18 12:34:17 CET 2008


For some strange reason my original patch (perl plugin: Warn if
"EnableDebugger" has been used after "LoadPlugin".) has been applied at the
wrong position (it has been applied to perl_config_includedir() instead of
perl_config_enabledebugger() - I have absolutely no clue why though).

Also, the check for the precondition of this warning has been fixed. In some
cases aTHX does not seem to be set, even though the Perl interpreter has
already been initialized. Now, perl_threads is used to check for that
condition.

Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 src/perl.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/perl.c b/src/perl.c
index 6d3326f..d17551e 100644
--- a/src/perl.c
+++ b/src/perl.c
@@ -1478,6 +1478,11 @@ static int perl_config_enabledebugger (pTHX_ oconfig_item_t *ci)
 		return 1;
 	}
 
+	if (NULL != perl_threads) {
+		log_warn ("EnableDebugger has no effects if used after LoadPlugin.");
+		return 1;
+	}
+
 	value = ci->values[0].value.string;
 
 	perl_argv = (char **)realloc (perl_argv,
@@ -1514,11 +1519,6 @@ static int perl_config_includedir (pTHX_ oconfig_item_t *ci)
 		return 1;
 	}
 
-	if (NULL == aTHX) {
-		log_warn ("EnableDebugger has no effects if used after LoadPlugin.");
-		return 1;
-	}
-
 	value = ci->values[0].value.string;
 
 	if (NULL == aTHX) {
-- 
1.5.4.2.133.g3d51e

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080318/c11d6900/attachment.pgp 


More information about the collectd mailing list