diff options
Diffstat (limited to 'ext/Sys/Syslog/Syslog.pm')
-rw-r--r-- | ext/Sys/Syslog/Syslog.pm | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/ext/Sys/Syslog/Syslog.pm b/ext/Sys/Syslog/Syslog.pm index 95f89ce4fc..c7ce3ded96 100644 --- a/ext/Sys/Syslog/Syslog.pm +++ b/ext/Sys/Syslog/Syslog.pm @@ -70,9 +70,11 @@ Sets the socket type to be used for the next call to C<openlog()> or C<syslog()> and returns TRUE on success, undef on failure. -A value of 'unix' will connect to the UNIX domain socket returned by -C<_PATH_LOG> in F<syslog.ph>. A value of 'inet' will connect to an -INET socket returned by getservbyname(). Any other value croaks. +A value of 'unix' will connect to the UNIX domain socket returned by the +C<_PATH_LOG> macro (if you system defines it) in F<syslog.h>. A value of +'inet' will connect to an INET socket returned by getservbyname(). If +C<_PATH_LOG> is unavailable or if getservbyname() fails, returns undef. Any +other value croaks. The default is for the INET socket to be used. @@ -107,10 +109,15 @@ L<syslog(3)> =head1 AUTHOR -Tom Christiansen E<lt>F<tchrist@perl.com>E<gt> and Larry Wall E<lt>F<larry@wall.org>E<gt>. -UNIX domain sockets added by Sean Robinson E<lt>F<robinson_s@sc.maricopa.edu>E<gt> -with support from Tim Bunce <Tim.Bunce@ig.co.uk> and the perl5-porters mailing list. -Dependency on F<syslog.ph> replaced with XS code bu Tom Hughes E<lt>F<tom@compton.nu>E<gt>. +Tom Christiansen E<lt>F<tchrist@perl.com>E<gt> and Larry Wall +E<lt>F<larry@wall.org>E<gt>. + +UNIX domain sockets added by Sean Robinson +E<lt>F<robinson_s@sc.maricopa.edu>E<gt> with support from Tim Bunce +E<lt>F<Tim.Bunce@ig.co.uk>E<gt> and the perl5-porters mailing list. + +Dependency on F<syslog.ph> replaced with XS code by Tom Hughes +E<lt>F<tom@compton.nu>E<gt>. =cut @@ -159,7 +166,7 @@ sub setlogsock { local($setsock) = shift; &disconnect if $connected; if (lc($setsock) eq 'unix') { - if (defined &_PATH_LOG) { + if (length _PATH_LOG()) { $sock_type = 1; } else { return undef; @@ -274,7 +281,8 @@ 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(); + length($syslog) || croak "_PATH_LOG unavailable in syslog.h"; my $that = sockaddr_un($syslog) || croak "Can't locate $syslog"; socket(SYSLOG,AF_UNIX,SOCK_STREAM,0) || croak "socket: $!"; if (!connect(SYSLOG,$that)) { |