summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-10-16 20:13:06 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-10-16 20:13:06 +0000
commiteb77c55a3a340ca975ecf11f5b24bafe3df240c4 (patch)
treed35d5265e671ecd6f3dcdf85ba57eef4b3fb500e /sys/arch
parent71fe9f71678dc9f29c986ae8a197be06de921fe7 (diff)
Correctly honour spoofonly in readvdmlabel() to avoid reading the on-disk label
when it's not welcome.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/aviion/aviion/disksubr.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/arch/aviion/aviion/disksubr.c b/sys/arch/aviion/aviion/disksubr.c
index 881f6f58e56..e120c7845da 100644
--- a/sys/arch/aviion/aviion/disksubr.c
+++ b/sys/arch/aviion/aviion/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.56 2013/10/15 11:03:30 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.57 2013/10/16 20:13:05 miod Exp $ */
/*
* Copyright (c) 2013 Miodrag Vallat.
@@ -229,6 +229,13 @@ readvdmlabel(struct buf *bp, void (*strat)(struct buf *), struct disklabel *lp,
if (error == ENOENT)
return error;
+ if (partoffp != NULL)
+ *partoffp = 0;
+
+ /* don't read the on-disk label if we are in spoofed-only mode */
+ if (spoofonly != 0)
+ return 0;
+
bp->b_blkno = LABELSECTOR;
bp->b_bcount = lp->d_secsize;
CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
@@ -237,8 +244,6 @@ readvdmlabel(struct buf *bp, void (*strat)(struct buf *), struct disklabel *lp,
if ((error = biowait(bp)) != 0)
return error;
- if (partoffp != NULL)
- *partoffp = 0;
return checkdisklabel(bp->b_data + LABELOFFSET, lp,
DL_GETBSTART(lp), DL_GETBEND(lp));
}