Fix a FAT cluster allocation bug. From Tridge

This commit is contained in:
Gregory Nutt 2014-01-14 13:45:26 -06:00
parent 803cdfdaf1
commit 85e7e13bb0
2 changed files with 6 additions and 3 deletions

View File

@ -6433,4 +6433,7 @@
* configs/px4fmu-v2_upstream: Configuration for testing simple * configs/px4fmu-v2_upstream: Configuration for testing simple
configurations on the the PX4FMU v2. This version is incomplete configurations on the the PX4FMU v2. This version is incomplete
for the PX4 appliation and is not a replacement for the version for the PX4 appliation and is not a replacement for the version
in the PX4 GIT repository. in the PX4 GIT repository.
* fs/fat/fs_fat32.c: A correction to FAT cluster allocation from
Tridge via Lorenz Meier (2014-1-14).

View File

@ -623,7 +623,7 @@ fat_read_restart:
* cluster boundary * cluster boundary
*/ */
if (ff->ff_sectorsincluster < 1) if (buflen > 0 && ff->ff_sectorsincluster < 1)
{ {
/* Find the next cluster in the FAT. */ /* Find the next cluster in the FAT. */
@ -899,7 +899,7 @@ fat_write_restart:
* cluster boundary * cluster boundary
*/ */
if (ff->ff_sectorsincluster < 1) if (buflen > 0 && ff->ff_sectorsincluster < 1)
{ {
/* Extend the current cluster by one (unless lseek was used to /* Extend the current cluster by one (unless lseek was used to
* move the file position back from the end of the file) * move the file position back from the end of the file)