summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Cwd.pm6
-rw-r--r--lib/Sys/Syslog.pm15
-rwxr-xr-xlib/diagnostics.pm6
3 files changed, 16 insertions, 11 deletions
diff --git a/lib/Cwd.pm b/lib/Cwd.pm
index 6b845108c2..2636fd2e4f 100644
--- a/lib/Cwd.pm
+++ b/lib/Cwd.pm
@@ -114,8 +114,10 @@ sub getcwd
unless (@tst = lstat("$dotdots/$dir"))
{
warn "lstat($dotdots/$dir): $!";
- closedir(PARENT);
- return '';
+ # Just because you can't lstat this directory
+ # doesn't mean you'll never find the right one.
+ # closedir(PARENT);
+ # return '';
}
}
while ($dir eq '.' || $dir eq '..' || $tst[0] != $pst[0] ||
diff --git a/lib/Sys/Syslog.pm b/lib/Sys/Syslog.pm
index 0a0d25eb9b..671da9f996 100644
--- a/lib/Sys/Syslog.pm
+++ b/lib/Sys/Syslog.pm
@@ -6,6 +6,9 @@ use Carp;
@ISA = qw(Exporter);
@EXPORT = qw(openlog closelog setlogmask syslog);
+use Socket;
+use Sys::Hostname;
+
#
# syslog.pl
#
@@ -34,7 +37,7 @@ use Carp;
# $! = 55;
# syslog('info','problem was %m'); # %m == $! in syslog(3)
-$host = 'localhost' unless $host; # set $Syslog::host to change
+$host = hostname() unless $host; # set $Syslog::host to change
require 'syslog.ph';
@@ -146,11 +149,11 @@ sub xlate {
sub connect {
$pat = 'S n C4 x8';
- $af_unix = 1;
- $af_inet = 2;
+ $af_unix = AF_UNIX();
+ $af_inet = AF_INET();
- $stream = 1;
- $datagram = 2;
+ $stream = SOCK_STREAM();
+ $datagram = SOCK_DGRAM();
($name,$aliases,$proto) = getprotobyname('udp');
$udp = $proto;
@@ -158,7 +161,7 @@ sub connect {
($name,$aliase,$port,$proto) = getservbyname('syslog','udp');
$syslog = $port;
- if (chop($myname = `hostname`)) {
+ if ($myname = hostname()) {
($name,$aliases,$addrtype,$length,@addrs) = gethostbyname($myname);
croak "Can't lookup $myname" unless $name;
@bytes = unpack("C4",$addrs[0]);
diff --git a/lib/diagnostics.pm b/lib/diagnostics.pm
index 073a456c81..6016d961d8 100755
--- a/lib/diagnostics.pm
+++ b/lib/diagnostics.pm
@@ -1,6 +1,6 @@
#!/usr/local/bin/perl
eval 'exec perl -S $0 ${1+"$@"}'
- if $0;
+ if 0;
use Config;
$diagnostics::PODFILE= $Config{privlib} . "/pod/perldiag.pod";
@@ -406,14 +406,14 @@ sub warn_trap {
if (caller eq $WHOAMI or !splainthis($warning)) {
print STDERR $warning;
}
- &$oldwarn if $oldwarn and $oldwarn ne \&warn_trap;
+ &$oldwarn if defined $oldwarn and $oldwarn and $oldwarn ne \&warn_trap;
};
sub death_trap {
my $exception = $_[0];
splainthis($exception);
if (caller eq $WHOAMI) { print STDERR "INTERNAL EXCEPTION: $exception"; }
- &$olddie if defined $olddie and $olddie ne \&death_trap;
+ &$olddie if defined $olddie and $olddie and $olddie ne \&death_trap;
$SIG{__DIE__} = $SIG{__WARN__} = '';
confess "Uncaught exception from user code:\n\t$exception Bailing out";
# up we go; where we stop, nobody knows, but i think we die now