[collectd] [PATCH] perl plugin: Set $0 to "collectd".

Sebastian Harl sh at tokkee.org
Sun Oct 28 10:50:24 CET 2007


perl_parse() has to set it to "-e" which is not very meaningful. It would
be even nicer to set it to argv[0] but this is not available from inside
the plugin.

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

diff --git a/src/perl.c b/src/perl.c
index dde34b8..1ed9d00 100644
--- a/src/perl.c
+++ b/src/perl.c
@@ -831,6 +831,10 @@ static int init_pi (int argc, char **argv)
 		log_err ("module_register: Unable to bootstrap Collectd.");
 		exit (1);
 	}
+
+	/* Set $0 to "collectd" because perl_parse() has to set it to "-e". */
+	Perl_sv_setpv (perl, Perl_get_sv (perl, "0", 0), "collectd");
+
 	perl_run (perl);
 
 	plugin_register_log ("perl", perl_log);
-- 
1.5.3.4.395.g85b0

-------------- 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/20071028/7b1fd697/attachment.pgp 


More information about the collectd mailing list