From: espie Date: Tue, 18 Apr 2017 15:12:00 +0000 (+0000) Subject: recent perl have signal names we don't have, protect against that. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1b95f69e0d9bda4e2b9e88c1572474270449cbd6;p=openbsd recent perl have signal names we don't have, protect against that. also, allow child_error to take a parameter so that this can be used to decode an arbitrary wait() result. --- diff --git a/usr.sbin/pkg_add/OpenBSD/Error.pm b/usr.sbin/pkg_add/OpenBSD/Error.pm index 8aee71a8c74..7bc5880009b 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.31 2012/04/28 15:22:49 espie Exp $ +# $OpenBSD: Error.pm,v 1.32 2017/04/18 15:12:00 espie Exp $ # # Copyright (c) 2004-2010 Marc Espie # @@ -83,7 +83,9 @@ sub fillup_names for my $sym (keys %POSIX::) { next unless $sym =~ /^SIG([A-Z].*)/; - $signal_name[eval "&POSIX::$sym()"] = $1; + my $i = eval "&POSIX::$sym()"; + next unless defined $i; + $signal_name[$i] = $1; } # extra BSD signals $signal_name[5] = 'TRAP'; @@ -113,7 +115,7 @@ sub find_signal sub child_error { - my $error = $?; + my $error = shift // $?; my $extra = "";