diff options
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Handle.pm | 17 |
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; |