提交 809310e6 编写于 作者: B bernard.xiong

fix SEEK_END bug in lseek.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@185 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 4edb7214
...@@ -174,7 +174,7 @@ int write(int fd, char *buf, int len) ...@@ -174,7 +174,7 @@ int write(int fd, char *buf, int len)
| |
+------------------------------------------------------------------------------ +------------------------------------------------------------------------------
*/ */
int lseek(int fd, int offset, int dir) int lseek(int fd, int offset, int dir)
{ {
int result; int result;
struct dfs_fd* d; struct dfs_fd* d;
...@@ -196,7 +196,7 @@ int lseek(int fd, int offset, int dir) ...@@ -196,7 +196,7 @@ int lseek(int fd, int offset, int dir)
break; break;
case DFS_SEEK_END: case DFS_SEEK_END:
offset = d->pos - offset; offset += d->size;
break; break;
} }
...@@ -210,7 +210,7 @@ int lseek(int fd, int offset, int dir) ...@@ -210,7 +210,7 @@ int lseek(int fd, int offset, int dir)
/* release the ref-count of fd */ /* release the ref-count of fd */
fd_put(d); fd_put(d);
return result; return offset;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册