summaryrefslogtreecommitdiff
path: root/components/dfs/src
diff options
context:
space:
mode:
authorBernard Xiong <root@VM-152-115-ubuntu.(none)>2014-07-31 09:30:18 +0800
committerBernard Xiong <root@VM-152-115-ubuntu.(none)>2014-07-31 09:30:18 +0800
commit59c128c0733c4b3ffa61558bb2ce8bf981c78adb (patch)
tree8380bbb92262d915f80f1583ca1f19d45a92c0a4 /components/dfs/src
parent94883a92fbc43b41e4888beb27fc2c3e2a95d4f1 (diff)
[libc] fix compiling warning
Diffstat (limited to 'components/dfs/src')
-rw-r--r--components/dfs/src/dfs_posix.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c
index 96139837e9..a7d6159a1c 100644
--- a/components/dfs/src/dfs_posix.c
+++ b/components/dfs/src/dfs_posix.c
@@ -537,12 +537,17 @@ struct dirent *readdir(DIR *d)
if (fd == RT_NULL)
{
rt_set_errno(-DFS_STATUS_EBADF);
-
return RT_NULL;
}
- if (!d->num ||
- (d->cur += ((struct dirent *)(d->buf + d->cur))->d_reclen) >= d->num)
+ if (d->num)
+ {
+ struct dirent* dirent_ptr;
+ dirent_ptr = (struct dirent*)&d->buf[d->cur];
+ d->cur += dirent_ptr->d_reclen;
+ }
+
+ if (!d->num || d->cur >= d->num)
{
/* get a new entry */
result = dfs_file_getdents(fd,