From 08dded1f227e2823c06f5121e48ca122aed65831 Mon Sep 17 00:00:00 2001 From: Abhishek Mishra Date: Wed, 13 May 2026 22:37:12 +0000 Subject: [PATCH] fs/vfs: fix pseudoFS mode reporting Preserve only the existing file type bits (S_IFMT) and replace permission bits from inode->i_mode instead of merging them with |= semantics. This fixes pseudoFS stat()/ls mode reporting after chmod() updates. Signed-off-by: Abhishek Mishra --- fs/vfs/fs_stat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/vfs/fs_stat.c b/fs/vfs/fs_stat.c index 22209d6e8c6..7e4a29ac79c 100644 --- a/fs/vfs/fs_stat.c +++ b/fs/vfs/fs_stat.c @@ -454,7 +454,7 @@ int inode_stat(FAR struct inode *inode, FAR struct stat *buf, int resolve) } #ifdef CONFIG_PSEUDOFS_ATTRIBUTES - buf->st_mode |= inode->i_mode; + buf->st_mode = (buf->st_mode & S_IFMT) | inode->i_mode; buf->st_uid = inode->i_owner; buf->st_gid = inode->i_group; buf->st_atim = inode->i_atime;