[collectd] [PATCH 2/6] perl plugin: Removed logging calls from call_by_name().

Sebastian Harl sh at tokkee.org
Sat Nov 17 18:41:08 CET 2007


The function might be called from a logging callback resulting in an infinite
loop. Instead the error message is now saved in $@.

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

diff --git a/src/perl.c b/src/perl.c
index 4ae3cd1..05e4b52 100644
--- a/src/perl.c
+++ b/src/perl.c
@@ -751,7 +751,7 @@ static XS (Collectd_call_by_name)
 	char *name = NULL;
 
 	if (NULL == (tmp = get_sv ("Collectd::cb_name", 0))) {
-		log_debug ("Collectd::call_by_name: cb_name is not set.");
+		sv_setpv (get_sv ("@", 1), "cb_name has not been set");
 		CLEAR_STACK_FRAME;
 		return;
 	}
@@ -759,7 +759,7 @@ static XS (Collectd_call_by_name)
 	name = SvPV_nolen (tmp);
 
 	if (NULL == get_cv (name, 0)) {
-		log_err ("Collectd::call_by_name: Unknown callback \"%s\".", name);
+		sv_setpvf (get_sv ("@", 1), "unknown callback \"%s\"", name);
 		CLEAR_STACK_FRAME;
 		return;
 	}
-- 
1.5.3.4

-------------- 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/20071117/a7f023dd/attachment.pgp 


More information about the collectd mailing list