From 5ee5e2e3fe83bf75469c502000e0990d8e369b8d Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Mon, 19 Oct 2009 14:00:11 +0000 Subject: cleanup method that does more or less what's needed --- usr.sbin/pkg_add/OpenBSD/Handle.pm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'usr.sbin/pkg_add/OpenBSD') 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 # @@ -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; -- cgit v1.2.3