diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-05-26 12:22:39 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-05-26 12:22:39 +0000 |
commit | f6ef6f9ad26cf7b687c6e1a12132a9e1c7650c9e (patch) | |
tree | 82d24b3e76f16a7a0b8a7e6ca61a0f959b0c0678 | |
parent | b166defbe2763df8279fd5c9973b24632bc24ad8 (diff) |
base tests on $handle->has_error instead of $errors.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Vstat.pm | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 19 |
2 files changed, 17 insertions, 8 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm index e50380a7364..3e1baf7e8fc 100644 --- a/usr.sbin/pkg_add/OpenBSD/Vstat.pm +++ b/usr.sbin/pkg_add/OpenBSD/Vstat.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Vstat.pm,v 1.21 2007/05/25 13:18:57 espie Exp $ +# $OpenBSD: Vstat.pm,v 1.22 2007/05/26 12:22:38 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -256,12 +256,12 @@ sub has_error { my ($self, $error) = @_; if (!defined $self->{error}) { - return 0; + return undef; } if (defined $error) { return $self->{error} eq $error; } - return 1; + return $self->{error}; } package OpenBSD::UpdateSet; diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 40b1e49969a..5a7b92ab19a 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.266 2007/05/26 12:15:45 espie Exp $ +# $OpenBSD: pkg_add,v 1.267 2007/05/26 12:22:38 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -528,11 +528,20 @@ sub install_package } my $location = $cache->{$pkg}; - if ($errors > 0) { - $state->set_pkgname($pkg); - $state->fatal("Fatal error") unless defined $location; + if ($state->{forced}->{kitchensink}) { + if ($handle->has_error(OpenBSD::Handle::BAD_PACKAGE)) { + $state->set_pkgname($pkg); + $state->fatal("Fatal error") unless defined $location; + } else { + return () unless defined $location; + } } else { - return () unless defined $location; + if ($handle->has_error) { + $state->set_pkgname($pkg); + $state->fatal("Fatal error") unless defined $location; + } else { + return () unless defined $location; + } } if ($state->is_installed($location->{pkgname})) { |