summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2007-07-11 04:53:42 +0000
committermiod <miod@openbsd.org>2007-07-11 04:53:42 +0000
commit1331cf22bfadfc4b40b5a976179846ca59f1a0ab (patch)
treecd18450185446547b721f3a29aadd08b6898b440
parentDo not divide by zero in DISKLABELV1_FFS_FSIZE if the argument value is bogus; (diff)
downloadwireguard-openbsd-1331cf22bfadfc4b40b5a976179846ca59f1a0ab.tar.xz
wireguard-openbsd-1331cf22bfadfc4b40b5a976179846ca59f1a0ab.zip
Try reading a native label in the first sector, before trying to find
MBR-like partitions.
-rw-r--r--sys/arch/mac68k/mac68k/disksubr.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/arch/mac68k/mac68k/disksubr.c b/sys/arch/mac68k/mac68k/disksubr.c
index bff47bf9d38..48ffd0b8b7d 100644
--- a/sys/arch/mac68k/mac68k/disksubr.c
+++ b/sys/arch/mac68k/mac68k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.50 2007/06/20 18:15:45 deraadt Exp $ */
+/* $OpenBSD: disksubr.c,v 1.51 2007/07/11 04:53:42 miod Exp $ */
/* $NetBSD: disksubr.c,v 1.22 1997/11/26 04:18:20 briggs Exp $ */
/*
@@ -344,6 +344,9 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *),
bp = geteblk(size);
bp->b_dev = dev;
+ if (spoofonly)
+ goto doslabel;
+
bp->b_blkno = LABELSECTOR;
bp->b_bcount = size;
bp->b_flags = B_BUSY | B_READ;
@@ -360,10 +363,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *),
goto done;
}
- msg = readdoslabel(bp, strat, lp, NULL, spoofonly);
- if (msg == NULL)
- goto done;
-
/* Get a MI label */
bp->b_blkno = LABELSECTOR;
bp->b_bcount = lp->d_secsize;
@@ -378,6 +377,11 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *),
if (msg == NULL)
goto done;
+doslabel:
+ msg = readdoslabel(bp, strat, lp, NULL, spoofonly);
+ if (msg == NULL)
+ goto done;
+
#if defined(CD9660)
if (iso_disklabelspoof(dev, strat, lp) == 0) {
msg = NULL;