perl plugin: Removed logging calls from call_by_name().
authorSebastian Harl <sh@tokkee.org>
Sat, 17 Nov 2007 17:41:08 +0000 (18:41 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Tue, 20 Nov 2007 08:04:43 +0000 (09:04 +0100)
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@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/perl.c

index 4ae3cd1..05e4b52 100644 (file)
@@ -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;
        }