The 16-bit total count of sectors is set by newfs_msdos(8) when the number of
sectors is less than MAXU16 even if asked to format in FAT32.
This diff fixes that according to the FAT32 spec : "For FAT32 volumes, this
field [BPB_TotSec16] must be 0"
OK ?
Index: newfs_msdos.c
===================================================================
RCS file: /cvs/src/sbin/newfs_msdos/newfs_msdos.c,v
retrieving revision 1.27
diff -u -p -r1.27 newfs_msdos.c
--- newfs_msdos.c 23 Nov 2015 19:19:30 -0000 1.27
+++ newfs_msdos.c 26 Apr 2021 16:40:34 -0000
@@ -536,9 +536,10 @@ main(int argc, char *argv[])
cls == 1 ? "" : "s", bpb.bps * bpb.spc);
if (!bpb.mid)
bpb.mid = !bpb.hid ? 0xf0 : 0xf8;
- if (fat == 32)
+ if (fat == 32) {
bpb.rdcl = RESFTE;
- if (bpb.hid + bpb.bsec <= MAXU16) {
+ bpb.sec = 0;
+ } else if (bpb.hid + bpb.bsec <= MAXU16) {
bpb.sec = bpb.bsec;
bpb.bsec = 0;
}