From: Tim Bunce Date: Fri, 5 Sep 1997 00:00:00 +0000 (+0000) Subject: Syslog.pm and missing _PATH_LOG X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f8b75b0cbb4cfefef6615f3d2c4b628bbb796c92;p=p5sagit%2Fp5-mst-13.2.git Syslog.pm and missing _PATH_LOG (this is the same change as commit d6a06c6b3ce238e0862e09fdca0c17e9d40e9b2c, but as applied) --- diff --git a/lib/Sys/Syslog.pm b/lib/Sys/Syslog.pm index f6d9c35..709f578 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 or C. -A value of 'unix' will connect to the UNIX domain socket returned -by C<_PATH_LOG> in F. 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. If F fails to define +C<_PATH_LOG>, C returns C; 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 {