summaryrefslogtreecommitdiff
path: root/sys/arch/vax
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1997-09-27 17:04:12 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1997-09-27 17:04:12 +0000
commitf7508881ae634eead52e5b7ece1467c818bca32f (patch)
treedaa9626d7945870ba9d7cfc07a274d75c63e5b31 /sys/arch/vax
parent2645c8d2806bf3131a33a8561c0fb4c80c64b463 (diff)
Fix swapconf.c so it will not crash swap on nfs envs
Diffstat (limited to 'sys/arch/vax')
-rw-r--r--sys/arch/vax/vax/rootfil.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/sys/arch/vax/vax/rootfil.c b/sys/arch/vax/vax/rootfil.c
index ea79d7618a7..e4f4db44a26 100644
--- a/sys/arch/vax/vax/rootfil.c
+++ b/sys/arch/vax/vax/rootfil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rootfil.c,v 1.6 1997/09/10 12:04:51 maja Exp $ */
+/* $OpenBSD: rootfil.c,v 1.7 1997/09/27 17:04:11 niklas Exp $ */
/* $NetBSD: rootfil.c,v 1.14 1996/10/13 03:35:58 christos Exp $ */
/*
@@ -156,16 +156,22 @@ setroot()
void
swapconf()
{
- register struct swdevt *swp;
- register int nblks;
-
- for (swp = swdevt; swp->sw_dev; swp++)
- if (swp->sw_dev != NODEV &&bdevsw[major(swp->sw_dev)].d_psize){
- nblks =
- (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev);
- if (nblks != -1 &&
- (swp->sw_nblks == 0 || swp->sw_nblks > nblks))
- swp->sw_nblks = nblks;
- }
- dumpconf();
+ struct swdevt *swp;
+ u_int maj;
+ int nblks;
+
+ for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
+
+ maj = major(swp->sw_dev);
+ if (maj > nblkdev) /* paranoid? */
+ break;
+
+ if (bdevsw[maj].d_psize) {
+ nblks = (*bdevsw[maj].d_psize)(swp->sw_dev);
+ if (nblks > 0 &&
+ (swp->sw_nblks == 0 || swp->sw_nblks > nblks))
+ swp->sw_nblks = nblks;
+ swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
+ }
+ }
}