diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2015-09-01 16:47:25 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2015-09-01 16:47:25 +0000 |
commit | 6a99793015c49fe1f8ee7acf2f29150223c11c34 (patch) | |
tree | 66c02b29426229888ed863bcf514e639bbed1900 /sys | |
parent | 82888448b6cd94a56d3d1b91f9601775be981ca9 (diff) |
Always call readdoslabel() before readgptlabel(). Doubly always call them
in the same order. Fix writedisklabel() to follow these simple rules.
ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/disksubr.c | 8 | ||||
-rw-r--r-- | sys/arch/i386/i386/disksubr.c | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/sys/arch/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c index 0faca1ad128..fef3d0509f6 100644 --- a/sys/arch/amd64/amd64/disksubr.c +++ b/sys/arch/amd64/amd64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.73 2015/08/26 13:56:04 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.74 2015/09/01 16:47:24 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -140,11 +140,11 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; + if (readdoslabel(bp, strat, lp, &partoff, 1) != 0) #if defined(GPT) - if (readgptlabel(bp, strat, lp, &partoff, 1) != 0) + if (readgptlabel(bp, strat, lp, &partoff, 1) != 0) #endif - if (readdoslabel(bp, strat, lp, &partoff, 1) != 0) - goto done; + goto done; /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = DL_BLKTOSEC(lp, partoff + DOS_LABELSECTOR) * diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index 3e4375dcd06..6458dc3f6da 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.111 2015/08/26 13:56:04 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.112 2015/09/01 16:47:24 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -139,10 +139,10 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; + if (readdoslabel(bp, strat, lp, &partoff, 1) != 0) #if defined(GPT) - if (readgptlabel(bp, strat, lp, &partoff, 1) != 0) + if (readgptlabel(bp, strat, lp, &partoff, 1) != 0) #endif - if (readdoslabel(bp, strat, lp, &partoff, 1) != 0) goto done; /* Read it in, slap the new label in, and write it back out */ |