diff --git a/fs/vfs/fs_chstat.c b/fs/vfs/fs_chstat.c index 93c4db7e60..38c0fb44f8 100644 --- a/fs/vfs/fs_chstat.c +++ b/fs/vfs/fs_chstat.c @@ -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; } diff --git a/fs/vfs/fs_fchstat.c b/fs/vfs/fs_fchstat.c index df9a6b87d1..44d8306988 100644 --- a/fs/vfs/fs_fchstat.c +++ b/fs/vfs/fs_fchstat.c @@ -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; }