summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-08-16 17:27:41 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-08-16 17:27:41 +0000
commit8a1e9ab9f5f947753d9beb48d70251e4d9450c07 (patch)
treefcd43cd2aab3c0c31fbc9abaa563c9e456baa00a /usr.sbin/pkg_add/OpenBSD
parentf4e8e4114b724e1be9cf99e199980fe1c4c368ea (diff)
check special names too.
Fixes a nasty bug: you could have /var/db/pkg mounted read-only, and still delete a package and keep the packing information around. Also makes pkg_add -r estimation of size more accurate, even though it usually doesn't matter, except for packages with huge packing-lists.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Delete.pm15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm
index bc656213401..6c798446ace 100644
--- a/usr.sbin/pkg_add/OpenBSD/Delete.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Delete.pm,v 1.24 2005/08/09 20:55:26 espie Exp $
+# $OpenBSD: Delete.pm,v 1.25 2005/08/16 17:27:40 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -113,6 +113,19 @@ sub validate_plist($$)
$problems++;
}
}
+ my $dir = installed_info($plist->pkgname());
+ for my $i (info_names()) {
+ my $fname = $dir.$i;
+ if (-e $fname) {
+ my $size = (stat _)[7];
+ my $s = OpenBSD::Vstat::remove($fname, $size);
+ next unless defined $s;
+ if ($s->{ro}) {
+ Warn "Error: ", $s->{dev}, " is read-only ($fname)\n";
+ $problems++;
+ }
+ }
+ }
Fatal "fatal issues" if $problems;
$totsize = 1 if $totsize == 0;
$plist->{totsize} = $totsize;