apps/examples/userfs: Fix bad logic in test stat() implementation.
This commit is contained in:
parent
9170155838
commit
342b51e9a6
@ -492,11 +492,23 @@ static int ufstest_stat(FAR void *volinfo, FAR const char *relpath,
|
|||||||
FAR void *openinfo;
|
FAR void *openinfo;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = ufstest_open(volinfo, relpath, O_RDWR, 0644, &openinfo);
|
/* Are we stat'ing the directory? Of one of the files in the directory? */
|
||||||
if (ret >= 0)
|
|
||||||
|
if (*relpath == '\0')
|
||||||
{
|
{
|
||||||
ret = ufstest_fstat(volinfo, openinfo, buf);
|
memset(buf, 0, sizeof(struct stat));
|
||||||
(void)ufstest_close(volinfo, openinfo);
|
buf->st_mode = (S_IFDIR | S_IRWXU | S_IRUSR | S_IRGRP | S_IRWXG |
|
||||||
|
S_IROTH | S_IRWXO);
|
||||||
|
buf->st_blksize = UFSTEST_FS_BLOCKSIZE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = ufstest_open(volinfo, relpath, O_RDWR, 0644, &openinfo);
|
||||||
|
if (ret >= 0)
|
||||||
|
{
|
||||||
|
ret = ufstest_fstat(volinfo, openinfo, buf);
|
||||||
|
(void)ufstest_close(volinfo, openinfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user