summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-03-18 10:57:13 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-03-18 10:57:13 +0000
commit4f2db787117b289cbca97c1387a84acf048d2aef (patch)
tree6a2d943b96df4b1e76cfbc5de910a089d865180b
parent80777fa4c27a8915403627b432e7b7ffc2509620 (diff)
remove some unnecessary sanity checks. /var/db/pkg is supposed to contain
only packages, so it's not really necessary to check for file existence and rights. Besides, actual use of package stuff will try reading +CONTENTS in a guarded way, so it will error out sanely... Trims out hundreds of stat() under /var/db/pkg, which are largely responsible for the slow start time of pkg_* tools.
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageInfo.pm17
1 files changed, 2 insertions, 15 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm
index 77209acef1d..3278016627d 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageInfo.pm,v 1.20 2007/02/22 21:31:41 espie Exp $
+# $OpenBSD: PackageInfo.pm,v 1.21 2007/03/18 10:57:12 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -57,26 +57,13 @@ for my $i (@info) {
sub _init_list
{
$list = {};
- my @bad=();
opendir(my $dir, $pkg_db) or die "Bad pkg_db: $!";
while (my $e = readdir($dir)) {
next if $e eq '.' or $e eq '..';
- next unless -d "$pkg_db/$e";
- if (! -r _) {
- push(@bad, $e);
- next;
- }
- if (-f "$pkg_db/$e/+CONTENTS") {
- $list->{$e} = 1;
- } else {
- print "Warning: $e is not really a package\n";
- }
+ $list->{$e} = 1;
}
close($dir);
- if (@bad > 0) {
- print "Warning: can't access information for ", join(", ", @bad), "\n";
- }
}
sub add_installed