Subject: | Can't log to unix sockets |
The following code illustrates the problem in Sys-Syslog-0.16:
#!/usr/local/bin/perl -w
use strict;
use Sys::Syslog qw(:DEFAULT setlogsock);
setlogsock("unix")
or die "error on setlogsock(): $!";
openlog("test_syslog", "ndelay,pid", "local0")
or die "error on openlog(): $!";
syslog("info", "test")
or die "error on syslog(): $!";
closelog
or die "error on closelog(): $!";
When I run this, I get the following error:
no connection to syslog available
- _PATH_LOG not available in syslog.h at test_syslog.pl line 7
I noticed the problem when I rebooted this evening and spamd (part of
spamassassin 3.1.3) printed this error when it restarted.
This patch appears to fix it:
--- Syslog.pm.orig 2006-06-20 17:22:31.000000000 -0400
+++ Syslog.pm 2006-07-21 23:32:39.000000000 -0400
@@ -520,7 +520,7 @@
my ($errs) = @_;
if (not defined $syslog_path and length _PATH_LOG()) {
$syslog_path = _PATH_LOG();
- } else {
+ } elsif (not defined $syslog_path) {
push @$errs, "_PATH_LOG not available in syslog.h";
return 0;
}
And finally, some information about my platform:
% perl -v
This is perl, v5.8.8 built for i686-linux
% uname -a
Linux caspar 2.6.16-2-686-smp #1 SMP Sat Jul 15 22:33:00 UTC 2006 i686
GNU/Linux