summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-07-01 10:36:47 +0000
committer[email protected] <[email protected]>2012-07-01 10:36:47 +0000
commite040266967ac193c50cd7855491e5ec642226ded (patch)
treeb1792f35982bf2c3487cf99eaa928b9b8feb0441
parentd402cfea19d33092606e1166efa83d245e150e29 (diff)
fix bug in f_seekdir in elm fatfs, with the patch provided by [email protected]
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2198 bbd45198-f89e-11dd-88c7-29a3b14d5316
-rw-r--r--components/dfs/filesystems/elmfat/ff.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/components/dfs/filesystems/elmfat/ff.c b/components/dfs/filesystems/elmfat/ff.c
index 1896bf2051..f6b85c30c8 100644
--- a/components/dfs/filesystems/elmfat/ff.c
+++ b/components/dfs/filesystems/elmfat/ff.c
@@ -3033,10 +3033,22 @@ FRESULT f_seekdir(
int offset /* the seek offset */
)
{
- return dir_sdi(dj, offset); /* seek directory index to offset */
+ int i = 0;
+
+ if (dir_sdi(dj, 0) != FR_OK || offset < 0)
+ return FR_INT_ERR;
+
+ while(i < offset)
+ {
+ if(dir_read(dj) != FR_OK || dir_next(dj, 0) != FR_OK)
+ return FR_INT_ERR;
+ i++;
+ }
+ return FR_OK;
}
+
#if _FS_MINIMIZE == 0
/*-----------------------------------------------------------------------*/
/* Get File Status */