summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Bunce <Tim.Bunce@ig.co.uk>1997-09-05 00:00:00 +0000
committerTim Bunce <Tim.Bunce@ig.co.uk>1997-09-05 00:00:00 +0000
commitf8b75b0cbb4cfefef6615f3d2c4b628bbb796c92 (patch)
tree1833d7e4abec58c8eb575fa96c9fb0364d3a47f5 /lib
parent307ff3209540c536853b0a1789542a7d8a58f06d (diff)
downloadperl-f8b75b0cbb4cfefef6615f3d2c4b628bbb796c92.tar.gz
Syslog.pm and missing _PATH_LOG
(this is the same change as commit d6a06c6b3ce238e0862e09fdca0c17e9d40e9b2c, but as applied)
Diffstat (limited to 'lib')
-rw-r--r--lib/Sys/Syslog.pm18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Sys/Syslog.pm b/lib/Sys/Syslog.pm
index f6d9c3547e..709f5785f5 100644
--- a/lib/Sys/Syslog.pm
+++ b/lib/Sys/Syslog.pm
@@ -54,15 +54,16 @@ is replaced with C<"$!"> (the latest error message).
Sets log mask I<$mask_priority> and returns the old mask.
-=item setlogsock $sock_type
+=item setlogsock $sock_type (added in 5.004_03)
Sets the socket type to be used for the next call to
C<openlog()> or C<syslog()>.
-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
+C<_PATH_LOG> in F<syslog.ph>. If F<syslog.ph> fails to define
+C<_PATH_LOG>, C<setlogsock> returns C<undef>; otherwise a true value is
+returned. A value of 'inet' will connect to an INET socket returned by
+getservbyname(). Any other value croaks.
The default is for the INET socket to be used.
@@ -135,12 +136,17 @@ sub setlogmask {
sub setlogsock {
local($setsock) = shift;
if (lc($setsock) eq 'unix') {
- $sock_unix = 1;
+ if (defined &_PATH_LOG) {
+ $sock_unix = 1;
+ } else {
+ return undef;
+ }
} elsif (lc($setsock) eq 'inet') {
undef($sock_unix);
} else {
croak "Invalid argument passed to setlogsock; must be 'unix' or 'inet'";
}
+ return 1;
}
sub syslog {