fix readdir issue.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@147 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
6c27bf33ff
commit
fee61e2c2a
|
@ -302,9 +302,9 @@ int dfs_elm_getdents(struct dfs_fd* file, struct dfs_dirent* dirp, rt_uint32_t c
|
|||
if (fno.fattrib & AM_DIR) d->d_type &= DFS_DT_DIR;
|
||||
else d->d_type &= DFS_DT_REG;
|
||||
|
||||
d->d_namlen = rt_strlen(fn) - 1;
|
||||
d->d_namlen = rt_strlen(fn);
|
||||
d->d_reclen = (rt_uint16_t)sizeof(struct dfs_dirent);
|
||||
rt_strncpy(d->d_name, fn, rt_strlen(fn));
|
||||
rt_strncpy(d->d_name, fn, rt_strlen(fn) + 1);
|
||||
|
||||
index ++;
|
||||
if ( index * sizeof(struct dfs_dirent) >= count )
|
||||
|
|
|
@ -356,7 +356,11 @@ DIR* opendir(const char* name)
|
|||
dfile_raw_close(d);
|
||||
fd_put(d);
|
||||
}
|
||||
else t->fd = fd;
|
||||
else
|
||||
{
|
||||
rt_memset(t, 0, sizeof(DIR));
|
||||
t->fd = fd;
|
||||
}
|
||||
fd_put(d);
|
||||
return t;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue