From 78fa87c7db08947bfd58c64d08e6824ccef09d44 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 13 Feb 2017 16:56:55 -0600 Subject: [PATCH] ROMFS: stat() and fstat() should always indicate that directories are executable. --- fs/romfs/fs_romfs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/romfs/fs_romfs.c b/fs/romfs/fs_romfs.c index f71425df33..083f5760d0 100644 --- a/fs/romfs/fs_romfs.c +++ b/fs/romfs/fs_romfs.c @@ -1184,13 +1184,10 @@ static int romfs_stat_common(uint8_t type, uint32_t size, memset(buf, 0, sizeof(struct stat)); 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; - if (IS_EXECUTABLE(type)) - { - buf->st_mode |= S_IXOTH | S_IXGRP | S_IXUSR; - } + buf->st_mode = S_IFDIR | S_IROTH | S_IXOTH | S_IRGRP | S_IXGRP | + S_IRUSR | S_IXUSR; } 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; if (IS_EXECUTABLE(type)) { + /* It's a read-execute file name */ + buf->st_mode |= S_IXOTH | S_IXGRP | S_IXUSR; } }