summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/Ustar.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2011-03-20 08:17:25 +0000
committerMarc Espie <espie@cvs.openbsd.org>2011-03-20 08:17:25 +0000
commitcd14f6596fae0c955acaad69b76ea6090934117f (patch)
tree065f0e791c90d7a48ebfe60a725a383cdc832259 /usr.sbin/pkg_add/OpenBSD/Ustar.pm
parentf33731d4a26196ef6b16bc6822b52edc09242983 (diff)
allow Ustar to be more precise in its error messages: record position
in archive, and caller can set description of file handle
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/Ustar.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Ustar.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Ustar.pm b/usr.sbin/pkg_add/OpenBSD/Ustar.pm
index a7d69814918..332fbe79e14 100644
--- a/usr.sbin/pkg_add/OpenBSD/Ustar.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Ustar.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Ustar.pm,v 1.70 2011/01/03 19:02:01 espie Exp $
+# $OpenBSD: Ustar.pm,v 1.71 2011/03/20 08:17:24 espie Exp $
#
# Copyright (c) 2002-2007 Marc Espie <espie@openbsd.org>
#
@@ -66,10 +66,18 @@ sub new
destdir => $destdir} , $class;
}
+sub set_description
+{
+ my ($self, $d) = @_;
+ $self->{description} = $d;
+}
+
sub fatal
{
my ($self, $msg, @args) = @_;
- $self->{state}->fatal("Ustar: $msg", @args);
+ $self->{state}->fatal("Ustar [#1][#2]: #3",
+ $self->{description} // '?', $self->{lastname} // '?',
+ $self->{state}->f($msg, @args));
}
sub new_object
@@ -157,6 +165,7 @@ sub next
$name = "$prefix/$name";
}
+ $self->{lastname} = $name;
$size = oct($size);
my $result= {
name => $name,