diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-11-16 12:58:13 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-11-16 12:58:13 +0000 |
commit | fad8a0fa7f28f224ff5659167e93f70449935957 (patch) | |
tree | e0974da9be4764553850c08a7b4b10a5de353e1a | |
parent | 348926346cd65fe78c75f4c8d58ac795ea068b68 (diff) |
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.c | 6 |
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) { |