diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-04-29 19:55:24 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-04-29 19:55:24 +0000 |
commit | 150b260b14b51796fc2bc1a3a4c7b0de7d4daf7d (patch) | |
tree | c6b411cb7f196920c37444bd85b4607e247fd26f /ext | |
parent | b2ec7025a588bf216a835c23fbc857664a8cd556 (diff) | |
download | perl-150b260b14b51796fc2bc1a3a4c7b0de7d4daf7d.tar.gz |
make lib/syslog.t portable to systems that don't have _PATH_LOG,
make _PATH_LOG() return "" if unavailable
p4raw-id: //depot/perl@6018
Diffstat (limited to 'ext')
-rw-r--r-- | ext/File/Glob/Glob.pm | 6 | ||||
-rw-r--r-- | ext/Sys/Syslog/Syslog.pm | 26 | ||||
-rw-r--r-- | ext/Sys/Syslog/Syslog.xs | 3 |
3 files changed, 21 insertions, 14 deletions
diff --git a/ext/File/Glob/Glob.pm b/ext/File/Glob/Glob.pm index 1353d4ffc6..98ee34d57d 100644 --- a/ext/File/Glob/Glob.pm +++ b/ext/File/Glob/Glob.pm @@ -331,9 +331,9 @@ Be aware that all filenames returned from File::Glob are tainted. =item * If you want to use multiple patterns, e.g. C<bsd_glob "a* b*">, you should -probably throw them in a set as in C<glob "{a*,b*}">. This is because -the argument to glob isn't subjected to parsing by the C shell. Remember -that you can use a backslash to escape things. +probably throw them in a set as in C<bsd_glob "{a*,b*}">. This is because +the argument to bsd_glob() isn't subjected to parsing by the C shell. +Remember that you can use a backslash to escape things. =item * 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)) { diff --git a/ext/Sys/Syslog/Syslog.xs b/ext/Sys/Syslog/Syslog.xs index f0573b8109..31c0e845a2 100644 --- a/ext/Sys/Syslog/Syslog.xs +++ b/ext/Sys/Syslog/Syslog.xs @@ -550,8 +550,7 @@ _PATH_LOG() #ifdef _PATH_LOG RETVAL = _PATH_LOG; #else - croak("Your vendor has not defined the Sys::Syslog macro _PATH_LOG"); - RETVAL = NULL; + RETVAL = ""; #endif OUTPUT: RETVAL |