summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2014-01-14 00:12:53 +1100
committerLorenz Meier <lm@inf.ethz.ch>2014-01-14 07:56:45 +0100
commita7b819f5b92d639a0602582411601c6b3714e730 (patch)
treed9e7c7aba380a211e8bb983cfd91eed1efdc1903
parentc3b289e604a944f2c78f7b0eb8a2bfd1e66d198d (diff)
downloadpx4-nuttx-a7b819f5b92d639a0602582411601c6b3714e730.tar.gz
px4-nuttx-a7b819f5b92d639a0602582411601c6b3714e730.tar.bz2
px4-nuttx-a7b819f5b92d639a0602582411601c6b3714e730.zip
FAT: cope with files of size equal to multiple of cluster size
when the file size is 4096 we should use 1 cluster, not two
-rw-r--r--nuttx/fs/fat/fs_fat32.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c
index e7e32eee2..f55475f09 100644
--- a/nuttx/fs/fat/fs_fat32.c
+++ b/nuttx/fs/fat/fs_fat32.c
@@ -621,7 +621,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. */
@@ -896,7 +896,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)