summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-24 10:06:36 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-24 10:06:36 +0000
commit05486843bb1b94789dd5c3aa06fbeeac3fb228ac (patch)
treefdf484f0ef079fab09a8de2768f2db4151c2ce4b /usr.sbin/pkg_add
parente165630ede382f3633d48743bdf36d88eec70123 (diff)
catch up and rethrow Packing-List read issues with the filename when
available.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm5
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm12
2 files changed, 12 insertions, 5 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index cf6dfde14c7..fa936e441e1 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingElement.pm,v 1.113 2007/05/22 09:39:24 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.114 2007/05/24 10:06:35 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -35,8 +35,7 @@ sub create
if (defined $keyword{$1}) {
$keyword{$1}->add($plist, $2);
} else {
- print STDERR "Unknown element: $line\n";
- exit 1 ;
+ die "Unknown element: $line";
}
} else {
OpenBSD::PackingElement::File->add($plist, $line);
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
index ea701a684f8..7448a264131 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingList.pm,v 1.63 2007/05/03 14:47:29 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.64 2007/05/24 10:06:35 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -247,7 +247,15 @@ sub fromfile
{
my ($a, $fname, $code) = @_;
open(my $fh, '<', $fname) or return;
- my $plist = $a->read($fh, $code);
+ my $plist;
+ eval {
+ $plist = $a->read($fh, $code);
+ };
+ if ($@) {
+ chomp $@;
+ $@ =~ s/\.$/,/;
+ die "$@ in $fname, ";
+ }
close($fh);
return $plist;
}