summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2011-07-23 15:04:28 +0000
committerMarc Espie <espie@cvs.openbsd.org>2011-07-23 15:04:28 +0000
commit15a086bab61b433f3905b3f8aebe694baef41d3e (patch)
treee5eaa6f4fda0b4006e1e43411b67e52707e33124
parentf0ac53abdc774caba58d45113103c0369ae19579 (diff)
avoid weird warnings in case we run into a strange package.
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgAdd.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
index 5feb1eb57a0..d66bc44efa5 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgAdd.pm,v 1.29 2011/07/17 13:16:15 espie Exp $
+# $OpenBSD: PkgAdd.pm,v 1.30 2011/07/23 15:04:27 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -326,6 +326,11 @@ sub complete
my $o = $set->{older}->{$pkgname};
if (!defined $o) {
$o = OpenBSD::Handle->create_old($pkgname, $state);
+ if (!defined $o->pkgname) {
+ $state->{bad}++;
+ $set->cleanup(OpenBSD::Handle::CANT_INSTALL, "Bogus package already installed");
+ return 1;
+ }
$set->add_older($o);
}
$o->{update_found} = $o;