fixed the O_APPEND and lseek issue in DFS FatFS.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2496 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2012-12-19 01:57:43 +00:00
parent 1fa210e6e3
commit a741197fa7
1 changed files with 5 additions and 1 deletions

View File

@ -13,6 +13,7 @@
* 2011-10-08 Bernard fixed the block size in statfs.
* 2011-11-23 Bernard fixed the rename issue.
* 2012-07-26 aozima implement ff_memalloc and ff_memfree.
* 2012-12-19 Bernard fixed the O_APPEND and lseek issue.
*/
#include <rtthread.h>
@ -327,7 +328,9 @@ int dfs_elm_open(struct dfs_fd *file)
if (file->flags & DFS_O_APPEND)
{
file->pos = f_lseek(fd, fd->fsize);
/* seek to the end of file */
f_lseek(fd, fd->fsize);
file->pos = fd->fptr;
}
}
else
@ -452,6 +455,7 @@ int dfs_elm_lseek(struct dfs_fd *file, rt_off_t offset)
if (result == FR_OK)
{
/* return current position */
file->pos = fd->fptr;
return fd->fptr;
}
}