diff options
author | Hans Insulander <hin@cvs.openbsd.org> | 2002-02-01 10:06:19 +0000 |
---|---|---|
committer | Hans Insulander <hin@cvs.openbsd.org> | 2002-02-01 10:06:19 +0000 |
commit | e2b0db5551a87a521348802af578b64a100c648a (patch) | |
tree | ed59703aeb0807660906d5e3589096ffff09dbbc /sys | |
parent | 42e338c2278d4f528518951fbdc021d4ba6f1351 (diff) |
cdstrategy(): check that media is loaded before doing anything with the
cd.
ok art@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/scsi/cd.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index a9046485b64..8baa37cd1cf 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.57 2001/10/25 12:59:21 drahn Exp $ */ +/* $OpenBSD: cd.c,v 1.58 2002/02/01 10:06:18 hin Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -515,18 +515,18 @@ cdstrategy(bp) SC_DEBUG(cd->sc_link, SDEV_DB1, ("%ld bytes @ blk %d\n", bp->b_bcount, bp->b_blkno)); /* - * The transfer must be a whole number of blocks. + * If the device has been made invalid, error out + * maybe the media changed, or no media loaded */ - if ((bp->b_bcount % cd->sc_dk.dk_label->d_secsize) != 0) { - bp->b_error = EINVAL; + if ((cd->sc_link->flags & SDEV_MEDIA_LOADED) == 0) { + bp->b_error = EIO; goto bad; } /* - * If the device has been made invalid, error out - * maybe the media changed + * The transfer must be a whole number of blocks. */ - if ((cd->sc_link->flags & SDEV_MEDIA_LOADED) == 0) { - bp->b_error = EIO; + if ((bp->b_bcount % cd->sc_dk.dk_label->d_secsize) != 0) { + bp->b_error = EINVAL; goto bad; } /* |