27 Jul 2011 16:55
Syslog problems
Davide Brini <dave_br <at> gmx.com>
2011-07-27 14:55:29 GMT
2011-07-27 14:55:29 GMT
Hi, I'm using the stable mon-1.2.0-1 under Ubuntu 11.04 (Perl 5.10.1), and I
noticed that mon wasn't logging anything at all in syslog. Further
inspection revealed that the problem seems to be in the redefined syslog()
function:
no warnings; # Redefining syslog
sub syslog {
eval {
local $SIG{"__DIE__"}= sub { };
my <at> log = map { s/\%//mg; } <at> _;
Sys::Syslog::syslog( <at> log);
}
}
since $_ is aliased in a map {} block, when the function is passed constant
strings, the map {} on <at> _ fails with a "modification of a read-only value
attempted". However this is not apparent, not even in debug mode, since it
happens inside the eval{} block.
Suggested change (for example):
no warnings; # Redefining syslog
sub syslog {
eval {
local $SIG{"__DIE__"}= sub { };
my <at> log = <at> _;
s/\%//mg for ( <at> log);
Sys::Syslog::syslog( <at> log);
}
}
(Continue reading)
RSS Feed