Commit bf7ec93
committed
Fix calculation of cluster amount for FAT16 filesystems in FDISK (#70)
The routine that calculates the amount of clusters for a new FAT16
filesystem in FDSIK has a bug that appears when creating a filesystem
with a maximum amount of clusters possible: a 16-bit variable overflows
and turns into 0 when it should actually be 65536.
This causes the sector count in the boot sector to be higher than
the actual size of the filesystem, and thus when writing to an almost
full partition a "Disk error writing" error may appear.
This commit fixes this by adding an intermediate calculation that
prevents the variable from overflowing.1 parent 7b9c723 commit bf7ec93
1 file changed
+2
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | | - | |
| 416 | + | |
417 | 417 | | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
| 418 | + | |
422 | 419 | | |
423 | 420 | | |
424 | 421 | | |
| |||
0 commit comments