diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-03-28 02:39:08 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-03-28 02:39:08 +0000 |
commit | b815763cf274674af027dc3e8beeb7e8b17c1408 (patch) | |
tree | 536aee184848b335c3c040d57895493669fa9a3b /sys/dev | |
parent | 58afdbd1ea33944df577073f13232145541c6c50 (diff) |
In ccdsize(), check for CCDF_INITED before doing the ccdopen().
Adapted from NetBSD.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ccd.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c index b92d96a3ce0..e87d6a7f30a 100644 --- a/sys/dev/ccd.c +++ b/sys/dev/ccd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ccd.c,v 1.50 2002/11/10 21:23:09 miod Exp $ */ +/* $OpenBSD: ccd.c,v 1.51 2003/03/28 02:39:07 millert Exp $ */ /* $NetBSD: ccd.c,v 1.33 1996/05/05 04:21:14 thorpej Exp $ */ /*- @@ -1456,17 +1456,20 @@ ccdsize(dev) dev_t dev; { struct ccd_softc *cs; - int part, size; + int part, size, unit; - if (ccdopen(dev, 0, S_IFBLK, curproc)) + unit = ccdunit(dev); + if (unit >= numccd) return (-1); - cs = &ccd_softc[ccdunit(dev)]; - part = DISKPART(dev); - + cs = &ccd_softc[unit]; if ((cs->sc_flags & CCDF_INITED) == 0) return (-1); + if (ccdopen(dev, 0, S_IFBLK, curproc)) + return (-1); + + part = DISKPART(dev); if (cs->sc_dkdev.dk_label->d_partitions[part].p_fstype != FS_SWAP) size = -1; else |