mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
ROMFS: stat() and fstat() should always indicate that directories are executable.
This commit is contained in:
+5
-6
@@ -1184,13 +1184,10 @@ static int romfs_stat_common(uint8_t type, uint32_t size,
|
|||||||
memset(buf, 0, sizeof(struct stat));
|
memset(buf, 0, sizeof(struct stat));
|
||||||
if (IS_DIRECTORY(type))
|
if (IS_DIRECTORY(type))
|
||||||
{
|
{
|
||||||
/* It's a read-only directory name */
|
/* It's a read-execute directory name */
|
||||||
|
|
||||||
buf->st_mode = S_IFDIR | S_IROTH | S_IRGRP | S_IRUSR;
|
buf->st_mode = S_IFDIR | S_IROTH | S_IXOTH | S_IRGRP | S_IXGRP |
|
||||||
if (IS_EXECUTABLE(type))
|
S_IRUSR | S_IXUSR;
|
||||||
{
|
|
||||||
buf->st_mode |= S_IXOTH | S_IXGRP | S_IXUSR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (IS_FILE(type))
|
else if (IS_FILE(type))
|
||||||
{
|
{
|
||||||
@@ -1199,6 +1196,8 @@ static int romfs_stat_common(uint8_t type, uint32_t size,
|
|||||||
buf->st_mode = S_IFREG | S_IROTH | S_IRGRP | S_IRUSR;
|
buf->st_mode = S_IFREG | S_IROTH | S_IRGRP | S_IRUSR;
|
||||||
if (IS_EXECUTABLE(type))
|
if (IS_EXECUTABLE(type))
|
||||||
{
|
{
|
||||||
|
/* It's a read-execute file name */
|
||||||
|
|
||||||
buf->st_mode |= S_IXOTH | S_IXGRP | S_IXUSR;
|
buf->st_mode |= S_IXOTH | S_IXGRP | S_IXUSR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user