summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2013-11-16 12:58:12 +0000
committerkrw <krw@openbsd.org>2013-11-16 12:58:12 +0000
commit3805594604a3ac76d06e8751831180d0247bac39 (patch)
treef7becadcf5860c8ba34c44fceba92ba5a3f680a8
parentEnable 802.11a support. Seems to work fine on: (diff)
downloadwireguard-openbsd-3805594604a3ac76d06e8751831180d0247bac39.tar.xz
wireguard-openbsd-3805594604a3ac76d06e8751831180d0247bac39.zip
In getdiskbyname() set partition size with DL_SETPSIZE(). Make sure
d_secperunith and p_offseth are set to 0 since they can't be read from disktab and lower 32 bits (d_secperunit and p_offset) are read directly from the input.
-rw-r--r--lib/libc/gen/disklabel.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/gen/disklabel.c b/lib/libc/gen/disklabel.c
index 0226ff0c055..0b9a97ba6af 100644
--- a/lib/libc/gen/disklabel.c
+++ b/lib/libc/gen/disklabel.c
@@ -94,6 +94,7 @@ getdiskbyname(const char *name)
getnumdflt(dp->d_type, "dt", 0);
getnumdflt(dp->d_secpercyl, "sc", dp->d_nsectors * dp->d_ntracks);
/* XXX */
+ dp->d_secperunith = 0;
getnumdflt(dp->d_secperunit, "su", dp->d_secpercyl * dp->d_ncylinders);
getnumdflt(dp->d_bbsize, "bs", BBSIZE);
getnumdflt(dp->d_sbsize, "sb", SBSIZE);
@@ -111,12 +112,13 @@ getdiskbyname(const char *name)
psize[1] = pbsize[1] = pfsize[1] = poffset[1] = ptype[1] = p;
/* XXX */
if (cgetnum(buf, psize, &f) == -1)
- pp->p_size = 0;
+ DL_SETPSIZE(pp, 0);
else {
u_int32_t fsize, frag = 8;
- pp->p_size = f;
+ DL_SETPSIZE(pp, f);
/* XXX */
+ pp->p_offseth = 0;
getnum(pp->p_offset, poffset);
getnumdflt(fsize, pfsize, 0);
if (fsize) {