diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c index b645fb7155b8..1c23b241e638 100644 --- a/sbin/newfs_msdos/newfs_msdos.c +++ b/sbin/newfs_msdos/newfs_msdos.c @@ -54,7 +54,7 @@ static const char rcsid[] = #define NPB 2 /* nibbles per byte */ #define DOSMAGIC 0xaa55 /* DOS magic number */ -#define MINBPS 128 /* minimum bytes per sector */ +#define MINBPS 512 /* minimum bytes per sector */ #define MAXSPC 128 /* maximum sectors per cluster */ #define MAXNFT 16 /* maximum number of FATs */ #define DEFBLK 4096 /* default block size */ @@ -623,17 +623,17 @@ main(int argc, char *argv[]) setstr(bs->oem, opt_O ? opt_O : "BSD 4.4", sizeof(bs->oem)); memcpy(img + x1, bootcode, sizeof(bootcode)); - mk2(img + bpb.bps - 2, DOSMAGIC); + mk2(img + MINBPS - 2, DOSMAGIC); } } else if (fat == 32 && bpb.infs != MAXU16 && (lsn == bpb.infs || (bpb.bkbs != MAXU16 && lsn == bpb.bkbs + bpb.infs))) { mk4(img, 0x41615252); - mk4(img + bpb.bps - 28, 0x61417272); - mk4(img + bpb.bps - 24, 0xffffffff); - mk4(img + bpb.bps - 20, bpb.rdcl); - mk2(img + bpb.bps - 2, DOSMAGIC); + mk4(img + MINBPS - 28, 0x61417272); + mk4(img + MINBPS - 24, 0xffffffff); + mk4(img + MINBPS - 20, bpb.rdcl); + mk2(img + MINBPS - 2, DOSMAGIC); } else if (lsn >= bpb.res && lsn < dir && !((lsn - bpb.res) % (bpb.spf ? bpb.spf : bpb.bspf))) {