diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-02-21 19:15:41 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-02-21 19:15:41 +0000 |
commit | 2d15828444656460893973d00dffc8964eba6dba (patch) | |
tree | 2460a0e8d7e496a30c280396fb6f2d2be645b7a5 /usr.sbin/pkg_add | |
parent | 170245419cea86f1c48bc499d558dae5cd9f397e (diff) |
distinguish between unreadable directories and non packages.
problem found by John L. Scarfone, who runs a paranoid root.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageInfo.pm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm index ae99bf292bd..a62662b7632 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm @@ -1,4 +1,4 @@ -# $OpenBSD: PackageInfo.pm,v 1.5 2004/01/27 00:14:42 espie Exp $ +# $OpenBSD: PackageInfo.pm,v 1.6 2004/02/21 19:15:40 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -81,18 +81,26 @@ sub installed_packages() { if (!defined $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"; + print "Warning: $e is not really a package\n"; } } close($dir); + if (@bad > 0) { + print "Warning: can't access information for ", join(", ", @bad), "\n"; + } } return keys %$list; } |