diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-07-07 22:00:07 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-07-07 22:00:07 +0000 |
commit | 2fdf09d2531bff9c879b8f6086d836de23e9e43f (patch) | |
tree | 31a44d211eb39a7012a4f52b69c2ae2d59824dba /usr.sbin/pkg_add/OpenBSD | |
parent | 2ed8592b01ac52ef2bfc422947dd658ee19bb79a (diff) |
guard against stat not working, which happened to me...
okay naddy@, sturm@
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Vstat.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm index 24332f4ed79..0778e75233b 100644 --- a/usr.sbin/pkg_add/OpenBSD/Vstat.pm +++ b/usr.sbin/pkg_add/OpenBSD/Vstat.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Vstat.pm,v 1.5 2004/04/28 06:47:12 espie Exp $ +# $OpenBSD: Vstat.pm,v 1.6 2004/07/07 22:00:06 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -46,6 +46,8 @@ sub create_mntpoint($) { my $mntpoint = shift; my $dev = (stat $mntpoint)[0]; + # check that stat worked + return undef unless defined $dev; my $n = $dirinfo->{"$dev"}; if (!defined $n) { $n = { mnt => $mntpoint, dev => $dev, used => 0 }; @@ -68,6 +70,7 @@ sub init_dirinfo() } elsif (m/^.*?\s+\d+\s+\d+\s+(\d+)\s+\d+\%\s+(\/.*?)$/) { my ($mntpoint, $avail) = ($2, $1); my $i = create_mntpoint($mntpoint); + next unless defined $i; $i->{avail} = $avail; } } @@ -79,6 +82,7 @@ sub init_dirinfo() if (m/^.*?\s+on\s+(\/.*?)\s+type\s+.*?(?:\s+\((.*?)\))?$/) { my ($mntpoint, $opts) = ($1, $2); my $i = create_mntpoint($mntpoint); + next unless defined $i; next unless defined $opts; for my $o (split /,\s*/, $opts) { if ($o eq 'read-only') { |