diff options
author | 2014-08-30 10:41:10 +0000 | |
---|---|---|
committer | 2014-08-30 10:41:10 +0000 | |
commit | 067c6712213f23ac6d0868a99ed65ab834213de7 (patch) | |
tree | e80c9b4d24b406868c50b65cde037ddcc466411a | |
parent | Set the MRU to a full size frame instead of basing it on the MTU. (diff) | |
download | wireguard-openbsd-067c6712213f23ac6d0868a99ed65ab834213de7.tar.xz wireguard-openbsd-067c6712213f23ac6d0868a99ed65ab834213de7.zip |
Make sure we check for GPT in writedisklabel() if kernel is compiled with GPT
support, for it would risk being overwritten otherwise.
From Markus Mueller
Diffstat (limited to '')
-rw-r--r-- | sys/arch/amd64/amd64/disksubr.c | 9 | ||||
-rw-r--r-- | sys/arch/i386/i386/disksubr.c | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/sys/arch/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c index ae83a2c6611..326c9eb95bd 100644 --- a/sys/arch/amd64/amd64/disksubr.c +++ b/sys/arch/amd64/amd64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.67 2014/07/13 15:32:28 miod Exp $ */ +/* $OpenBSD: disksubr.c,v 1.68 2014/08/30 10:41:10 miod Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -137,8 +137,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) - goto done; +#if defined(GPT) + 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 */ 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 a8bf13d7bb0..52ccb57917f 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.107 2014/07/13 15:32:28 miod Exp $ */ +/* $OpenBSD: disksubr.c,v 1.108 2014/08/30 10:41:10 miod Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -139,8 +139,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) - goto done; +#if defined(GPT) + 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 */ bp->b_blkno = DL_BLKTOSEC(lp, partoff + DOS_LABELSECTOR) * |