summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-01-14 13:45:26 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-01-14 13:45:26 -0600
commitafea68fe4ccd0443d61ccd35f4a6e8e97e41cf4a (patch)
tree1e612855d31dd4be070e4ad611b28f2c3ab86897
parent909af806c753228e9ae279432993c93e9180b54f (diff)
downloadnuttx-afea68fe4ccd0443d61ccd35f4a6e8e97e41cf4a.tar.gz
nuttx-afea68fe4ccd0443d61ccd35f4a6e8e97e41cf4a.tar.bz2
nuttx-afea68fe4ccd0443d61ccd35f4a6e8e97e41cf4a.zip
Fix a FAT cluster allocation bug. From Tridge
-rw-r--r--nuttx/ChangeLog5
-rw-r--r--nuttx/fs/fat/fs_fat32.c4
2 files changed, 6 insertions, 3 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index b7039d070..9c08ef7c7 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -6433,4 +6433,7 @@
* configs/px4fmu-v2_upstream: Configuration for testing simple
configurations on the the PX4FMU v2. This version is incomplete
for the PX4 appliation and is not a replacement for the version
- in the PX4 GIT repository. \ No newline at end of file
+ in the PX4 GIT repository.
+ * fs/fat/fs_fat32.c: A correction to FAT cluster allocation from
+ Tridge via Lorenz Meier (2014-1-14).
+
diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c
index 29d5b450f..cbbc3cd89 100644
--- a/nuttx/fs/fat/fs_fat32.c
+++ b/nuttx/fs/fat/fs_fat32.c
@@ -623,7 +623,7 @@ fat_read_restart:
* cluster boundary
*/
- if (ff->ff_sectorsincluster < 1)
+ if (buflen > 0 && ff->ff_sectorsincluster < 1)
{
/* Find the next cluster in the FAT. */
@@ -899,7 +899,7 @@ fat_write_restart:
* 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
* move the file position back from the end of the file)