From a7b819f5b92d639a0602582411601c6b3714e730 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 14 Jan 2014 00:12:53 +1100 Subject: 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 --- nuttx/fs/fat/fs_fat32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nuttx') 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) -- cgit v1.2.3