newfs_msdos: Allow -s option to work by itself

Signed-off-by: San Mehat <san@google.com>
This commit is contained in:
San Mehat 2010-03-03 12:40:21 -08:00
parent 503df20759
commit 661aff600c

View file

@ -414,11 +414,14 @@ newfs_msdos_main(int argc, char *argv[])
if (!(opt_f || (opt_h && opt_u && opt_S && opt_s && oflag))) {
off_t delta;
getdiskinfo(fd, fname, dtype, oflag, &bpb);
if (opt_s) {
bpb.bsec = opt_s;
}
bpb.bsec -= (opt_ofs / bpb.bps);
delta = bpb.bsec % bpb.spt;
if (delta != 0) {
warnx("trim %d sectors to adjust to a multiple of %d",
(int)delta, bpb.spt);
warnx("trim %d sectors from %d to adjust to a multiple of %d",
(int)delta, bpb.bsec, bpb.spt);
bpb.bsec -= delta;
}
if (bpb.spc == 0) { /* set defaults */