Fix an error in opendir() when a mountpoint is in the root directory.

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3432 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-03-28 17:43:34 +00:00
parent 9fc214c5a7
commit 7678f66537

View File

@ -310,7 +310,7 @@ static int binfs_opendir(struct inode *mountpt, const char *relpath,
struct binfs_state_s *bm;
int ret;
fvdbg("relpath: '%s'\n", relpath);
fvdbg("relpath: \"%s\"\n", relpath ? relpath : "NULL");
/* Sanity checks */
@ -352,8 +352,6 @@ static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
unsigned int index;
int ret;
fvdbg("Entry\n");
/* Sanity checks */
DEBUGASSERT(mountpt != NULL && mountpt->i_private != NULL);
@ -372,13 +370,14 @@ static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
* special error -ENOENT
*/
fdbg("End of directory\n");
fvdbg("Entry %d: End of directory\n", index);
ret = -ENOENT;
}
else
{
/* Save the filename and file type */
fvdbg("Entry %d: \"%s\"\n", index, namedapps[index].name);
dir->fd_dir.d_type = DTYPE_FILE;
strncpy(dir->fd_dir.d_name, namedapps[index].name, NAME_MAX+1);