diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2019-07-21 14:18:56 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2019-07-21 14:18:56 +0000 |
commit | 7d1061e4a67b45bdd73e02eb5687c7307e3ded96 (patch) | |
tree | ca45d11028c9dfef7855b5d9bda18ec523bcac55 /usr.sbin/pkg_add | |
parent | 1abd94574e34caa3a83a50445b7b667b54f15285 (diff) |
gc old functions, that part is clean as well...
so it's obviously the END code then...
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Error.pm | 88 |
1 files changed, 2 insertions, 86 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Error.pm b/usr.sbin/pkg_add/OpenBSD/Error.pm index 2a6aad4893b..0afad04b25f 100644 --- a/usr.sbin/pkg_add/OpenBSD/Error.pm +++ b/usr.sbin/pkg_add/OpenBSD/Error.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Error.pm,v 1.35 2019/07/17 19:00:55 sthen Exp $ +# $OpenBSD: Error.pm,v 1.36 2019/07/21 14:18:55 espie Exp $ # # Copyright (c) 2004-2010 Marc Espie <espie@openbsd.org> # @@ -63,95 +63,11 @@ __PACKAGE__->reset; package OpenBSD::Error; require Exporter; our @ISA=qw(Exporter); -our @EXPORT=qw(Copy Unlink try throw catch catchall rethrow); +our @EXPORT=qw(try throw catch catchall rethrow); our ($FileName, $Line, $FullMessage); -my @signal_name = (); - use Carp; - -sub fillup_names -{ - { - # XXX force autoload - package verylocal; - - require POSIX; - POSIX->import(qw(signal_h)); - } - - for my $sym (keys %POSIX::) { - next unless $sym =~ /^SIG([A-Z].*)/; - my $i = eval "&POSIX::$sym()"; - next unless defined $i; - $signal_name[$i] = $1; - } - # extra BSD signals - $signal_name[5] = 'TRAP'; - $signal_name[7] = 'IOT'; - $signal_name[10] = 'BUS'; - $signal_name[12] = 'SYS'; - $signal_name[16] = 'URG'; - $signal_name[23] = 'IO'; - $signal_name[24] = 'XCPU'; - $signal_name[25] = 'XFSZ'; - $signal_name[26] = 'VTALRM'; - $signal_name[27] = 'PROF'; - $signal_name[28] = 'WINCH'; - $signal_name[29] = 'INFO'; -} - -sub find_signal -{ - my $number = shift; - - if (@signal_name == 0) { - fillup_names(); - } - - return $signal_name[$number] || $number; -} - -sub child_error -{ - my $error = shift // $?; - - my $extra = ""; - - if ($error & 128) { - $extra = " (core dumped)"; - } - if ($error & 127) { - return "killed by signal ". find_signal($error & 127).$extra; - } else { - return "exit(". ($error >> 8) . ")$extra"; - } -} - -sub Copy -{ - require File::Copy; - - my $r = File::Copy::copy(@_); - if (!$r) { - print "copy(", join(',', @_),") failed: $!\n"; - } - return $r; -} - -sub Unlink -{ - my $verbose = shift; - my $r = unlink @_; - if ($r != @_) { - print "rm @_ failed: removed only $r targets, $!\n"; - } elsif ($verbose) { - print "rm @_\n"; - } - return $r; -} - sub dienow { my ($error, $handler) = @_; |