summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-10-19 14:00:11 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-10-19 14:00:11 +0000
commit5ee5e2e3fe83bf75469c502000e0990d8e369b8d (patch)
treea75934460632dc1863870fc57134cb60ee8349a6 /usr.sbin/pkg_add/OpenBSD
parentb5c53523aecd80ed1bf1930079d1b8c4ca1b23ec (diff)
cleanup method that does more or less what's needed
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Handle.pm17
1 files changed, 16 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Handle.pm b/usr.sbin/pkg_add/OpenBSD/Handle.pm
index 464698f035b..14f8e480c6c 100644
--- a/usr.sbin/pkg_add/OpenBSD/Handle.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Handle.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Handle.pm,v 1.5 2009/10/19 09:29:53 espie Exp $
+# $OpenBSD: Handle.pm,v 1.6 2009/10/19 14:00:10 espie Exp $
#
# Copyright (c) 2007-2009 Marc Espie <espie@openbsd.org>
#
@@ -29,6 +29,21 @@ use constant {
NOT_FOUND => 4
};
+sub cleanup
+{
+ my ($self, $error) = @_;
+ $self->{error} //= $error;
+ if (defined $self->location) {
+ if ($self->{error} == ALREADY_INSTALLED) {
+ $self->location->close_now;
+ } elsif ($self->{error} == CANT_INSTALL) {
+ $self->location->close_with_client_error;
+ }
+ $self->location->wipe_info;
+ }
+ delete $self->{plist};
+}
+
sub new
{
my $class = shift;