summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2014-02-07 14:06:44 +0000
committerMarc Espie <espie@cvs.openbsd.org>2014-02-07 14:06:44 +0000
commitcd803085ad7f4ecec69a6d27f1f091c48ca327f9 (patch)
tree91e589f4daffb64cb4397ef0f14bddc9bf33b069
parentafbad279e26b51e45bc76348ce80dc85d92568c5 (diff)
reclaim: we don't need to keep tracking temporary files/directories we
removed.
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository.pm5
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Temp.pm9
2 files changed, 12 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
index 9cf4da65632..f1437ea2f4a 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageRepository.pm,v 1.106 2014/02/06 22:58:26 espie Exp $
+# $OpenBSD: PackageRepository.pm,v 1.107 2014/02/07 14:06:43 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -158,7 +158,9 @@ sub wipe_info
my $dir = $pkg->{dir};
if (defined $dir) {
+ require OpenBSD::Temp;
OpenBSD::Error->rmtree($dir);
+ OpenBSD::Temp->reclaim($dir);
delete $pkg->{dir};
}
}
@@ -256,6 +258,7 @@ sub grabPlist
sub parse_problems
{
my ($self, $filename, $hint, $object) = @_;
+ OpenBSD::Temp->reclaim($filename);
unlink $filename;
}
diff --git a/usr.sbin/pkg_add/OpenBSD/Temp.pm b/usr.sbin/pkg_add/OpenBSD/Temp.pm
index d57940720fa..1373f1ad015 100644
--- a/usr.sbin/pkg_add/OpenBSD/Temp.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Temp.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Temp.pm,v 1.25 2012/04/28 15:22:49 espie Exp $
+# $OpenBSD: Temp.pm,v 1.26 2014/02/07 14:06:43 espie Exp $
#
# Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org>
#
@@ -85,6 +85,13 @@ sub file
return $file;
}
+sub reclaim
+{
+ my ($class, $name) = @_;
+ delete $files->{$name};
+ delete $dirs->{$name};
+}
+
sub permanent_file
{
my ($dir, $stem) = @_;