summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2021-08-09 16:41:22 +0000
committerMarc Espie <espie@cvs.openbsd.org>2021-08-09 16:41:22 +0000
commit0f6b5bf9774997a0541b21af6d7df35944e8e062 (patch)
tree25478f5a9f9c1025a749c493128070e6a9ead7b2 /usr.sbin/pkg_add
parent55fe58de65eef9dc14e49925d10d0ddb24182577 (diff)
for extraction, deal with created temp file directly:
- don't adjust the file object, just extract_to_fh - for may_check_digest, explicitly pass the path instead of a file object
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm10
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm10
2 files changed, 8 insertions, 12 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index 6c686d8e504..cc40120bab6 100644
--- a/usr.sbin/pkg_add/OpenBSD/Add.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Add.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Add.pm,v 1.185 2021/08/09 13:34:00 espie Exp $
+# $OpenBSD: Add.pm,v 1.186 2021/08/09 16:41:21 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -540,10 +540,6 @@ sub extract
return;
}
- # XXX don't apply destdir twice
- $file->{destdir} = '';
- $file->set_name($tempname);
-
$state->say("extract #1 -> #2", $self->name, $tempname)
if $state->verbose >= 3;
@@ -552,8 +548,8 @@ sub extract
$state->fatal("can't extract #1, it's not a file",
$self->stringize);
}
- $file->create;
- $self->may_check_digest($file, $state);
+ $file->extract_to_fh($fh);
+ $self->may_check_digest($tempname, $state);
}
}
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index 09aa645a100..7f7846a1e55 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.277 2020/06/09 20:16:12 sthen Exp $
+# $OpenBSD: PackingElement.pm,v 1.278 2021/08/09 16:41:21 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -434,21 +434,21 @@ sub make_hardlink
sub may_check_digest
{
- my ($self, $file, $state) = @_;
+ my ($self, $path, $state) = @_;
if ($state->{check_digest}) {
- $self->check_digest($file, $state);
+ $self->check_digest($path, $state);
}
}
sub check_digest
{
- my ($self, $file, $state) = @_;
+ my ($self, $path, $state) = @_;
return if $self->{link} or $self->{symlink};
if (!defined $self->{d}) {
$state->log->fatal($state->f("#1 does not have a signature",
$self->fullname));
}
- my $d = $self->compute_digest($file->{destdir}.$file->name);
+ my $d = $self->compute_digest($path);
if (!$d->equals($self->{d})) {
$state->log->fatal($state->f("checksum for #1 does not match",
$self->fullname));