summaryrefslogtreecommitdiff
path: root/nuttx/fs/fat
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-05-03 22:30:53 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-05-03 22:30:53 +0000
commit9fa76295cda66557b8eb992904275cc198137efd (patch)
tree52cc67ea5d12d12122d874691f0df8238704ec5a /nuttx/fs/fat
parent9c806fe8bfe8eabf3485c505edc7d4771d2f62ad (diff)
downloadpx4-nuttx-9fa76295cda66557b8eb992904275cc198137efd.tar.gz
px4-nuttx-9fa76295cda66557b8eb992904275cc198137efd.tar.bz2
px4-nuttx-9fa76295cda66557b8eb992904275cc198137efd.zip
Incorporate two FAT bugfixes reported by Sheref Younan.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3557 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs/fat')
-rw-r--r--nuttx/fs/fat/fs_fat32.c2
-rw-r--r--nuttx/fs/fat/fs_fat32util.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c
index 2d880dabc..4547d0b24 100644
--- a/nuttx/fs/fat/fs_fat32.c
+++ b/nuttx/fs/fat/fs_fat32.c
@@ -1179,7 +1179,7 @@ static int fat_sync(FAR struct file *filep)
* in the sector using the saved directory index.
*/
- direntry = &fs->fs_buffer[ff->ff_dirindex * 32];
+ direntry = &fs->fs_buffer[(ff->ff_dirindex & DIRSEC_NDXMASK(fs)) * 32];
/* Set the archive bit, set the write time, and update
* anything that may have* changed in the directory
diff --git a/nuttx/fs/fat/fs_fat32util.c b/nuttx/fs/fat/fs_fat32util.c
index aa8db91d5..a37f8fadb 100644
--- a/nuttx/fs/fat/fs_fat32util.c
+++ b/nuttx/fs/fat/fs_fat32util.c
@@ -649,7 +649,8 @@ int fat_mount(struct fat_mountpt_s *fs, bool writeable)
goto errout_with_buffer;
}
- if (fat_checkbootrecord(fs) != OK)
+ ret = fat_checkbootrecord(fs);
+ if (ret != OK)
{
/* The contents of sector 0 is not a boot record. It could be a
* partition, however. Assume it is a partition and get the offset
@@ -683,7 +684,8 @@ int fat_mount(struct fat_mountpt_s *fs, bool writeable)
/* Check if this is a boot record */
- if (fat_checkbootrecord(fs) != OK)
+ ret = fat_checkbootrecord(fs);
+ if (ret != OK)
{
fdbg("No valid MBR\n");
goto errout_with_buffer;