fs/vfs: fix st_mode mask check

The full mask for st_mode is 0177777
Now modify any file permissions in hostfs and all will fail
This commit is contained in:
yinshengkai 2022-04-08 12:06:17 +08:00 committed by Petro Karashchenko
parent 8d66dbc068
commit 4b6743591a
2 changed files with 2 additions and 2 deletions

View File

@ -118,7 +118,7 @@ static int chstat(FAR const char *path,
/* Adjust and check buf and flags */
if ((flags & CH_STAT_MODE) && (buf->st_mode & ~07777))
if ((flags & CH_STAT_MODE) && (buf->st_mode & ~0177777))
{
goto errout;
}

View File

@ -112,7 +112,7 @@ int file_fchstat(FAR struct file *filep, FAR struct stat *buf, int flags)
/* Adjust and check buf and flags */
if ((flags & CH_STAT_MODE) && (buf->st_mode & ~07777))
if ((flags & CH_STAT_MODE) && (buf->st_mode & ~0177777))
{
return -EINVAL;
}