提交 a741197f 编写于 作者: B bernard.xiong@gmail.com

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
上级 1fa210e6
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* 2011-10-08 Bernard fixed the block size in statfs. * 2011-10-08 Bernard fixed the block size in statfs.
* 2011-11-23 Bernard fixed the rename issue. * 2011-11-23 Bernard fixed the rename issue.
* 2012-07-26 aozima implement ff_memalloc and ff_memfree. * 2012-07-26 aozima implement ff_memalloc and ff_memfree.
* 2012-12-19 Bernard fixed the O_APPEND and lseek issue.
*/ */
#include <rtthread.h> #include <rtthread.h>
...@@ -327,7 +328,9 @@ int dfs_elm_open(struct dfs_fd *file) ...@@ -327,7 +328,9 @@ int dfs_elm_open(struct dfs_fd *file)
if (file->flags & DFS_O_APPEND) 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 else
...@@ -452,6 +455,7 @@ int dfs_elm_lseek(struct dfs_fd *file, rt_off_t offset) ...@@ -452,6 +455,7 @@ int dfs_elm_lseek(struct dfs_fd *file, rt_off_t offset)
if (result == FR_OK) if (result == FR_OK)
{ {
/* return current position */ /* return current position */
file->pos = fd->fptr;
return fd->fptr; return fd->fptr;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册