From: Gurusamy Sarathy Date: Thu, 27 Apr 2000 17:50:56 +0000 (+0000) Subject: fix Sys::Syslog breakage on domain sockets (from Tom Hughes) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=34b7e82b7f7d95b7207ac8f43025705af5f1aca0;p=p5sagit%2Fp5-mst-13.2.git fix Sys::Syslog breakage on domain sockets (from Tom Hughes) p4raw-id: //depot/perl@5969 --- diff --git a/MANIFEST b/MANIFEST index c347581..70932d8 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1298,6 +1298,7 @@ t/lib/socket.t See if Socket works t/lib/soundex.t See if Soundex works t/lib/symbol.t See if Symbol works t/lib/syslfs.t See if large files work for sysio +t/lib/syslog.t See if Sys::Syslog works t/lib/textfill.t See if Text::Wrap::fill works t/lib/texttabs.t See if Text::Tabs works t/lib/textwrap.t See if Text::Wrap::wrap works diff --git a/ext/Sys/Syslog/Syslog.pm b/ext/Sys/Syslog/Syslog.pm index 2a91354..d109a9d 100644 --- a/ext/Sys/Syslog/Syslog.pm +++ b/ext/Sys/Syslog/Syslog.pm @@ -274,7 +274,7 @@ sub connect { socket(SYSLOG,AF_INET,SOCK_DGRAM,$udp) || croak "socket: $!"; connect(SYSLOG,$that) || croak "connect: $!"; } else { - my $syslog = &_PATH_LOG || croak "_PATH_LOG not found in syslog.ph"; + my $syslog = _PATH_LOG() || croak "_PATH_LOG not found in syslog.ph"; my $that = sockaddr_un($syslog) || croak "Can't locate $syslog"; socket(SYSLOG,AF_UNIX,SOCK_STREAM,0) || croak "socket: $!"; if (!connect(SYSLOG,$that)) { diff --git a/t/lib/syslog.t b/t/lib/syslog.t new file mode 100755 index 0000000..2ed887a --- /dev/null +++ b/t/lib/syslog.t @@ -0,0 +1,23 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + unshift @INC, '../lib'; + require Config; import Config; + if ($Config{'extensions'} !~ /\bSyslog\b/) { + print "1..0 # Skip: Sys::Syslog was not built\n"; + exit 0; + } +} + +use Sys::Syslog qw(:DEFAULT setlogsock); + +print "1..6\n"; + +print defined(eval { setlogsock('unix') }) ? "ok 1\n" : "not ok 1\n"; +print defined(eval { openlog('perl', 'ndelay', 'local0') }) ? "ok 2\n" : "not ok 2\n"; +print defined(eval { syslog('info', 'test') }) ? "ok 3\n" : "not ok 3\n"; + +print defined(eval { setlogsock('inet') }) ? "ok 4\n" : "not ok 4\n"; +print defined(eval { openlog('perl', 'ndelay', 'local0') }) ? "ok 5\n" : "not ok 5\n"; +print defined(eval { syslog('info', 'test') }) ? "ok 6\n" : "not ok 6\n";