Skip to content

Commit

Permalink
[libc] fix compiling warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernard Xiong authored and Bernard Xiong committed Jul 31, 2014
1 parent 94883a9 commit 59c128c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
11 changes: 8 additions & 3 deletions components/dfs/src/dfs_posix.c
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions components/libc/newlib/syscalls.c
Expand Up @@ -3,6 +3,14 @@
#include <sys/time.h>
#include <rtthread.h>

#ifdef RT_USING_DFS
#include <dfs_posix.h>
#endif

#ifdef RT_USING_PTHREADS
#include <pthread.h>
#endif

/* Reentrant versions of system calls. */

int
Expand Down

0 comments on commit 59c128c

Please sign in to comment.