Kernel: Fix fchmodat mode handling

Ignore file type bits instead of returning EINVAL if they are set
This commit is contained in:
Bananymous 2025-05-29 03:21:01 +03:00
parent 50024fbf8b
commit cd5b351ce4
1 changed files with 1 additions and 3 deletions

View File

@ -1217,8 +1217,6 @@ namespace Kernel
BAN::ErrorOr<long> Process::sys_fchmodat(int fd, const char* path, mode_t mode, int flag)
{
if (mode & S_IFMASK)
return BAN::Error::from_errno(EINVAL);
if (flag & ~AT_SYMLINK_NOFOLLOW)
return BAN::Error::from_errno(EINVAL);
if (flag == AT_SYMLINK_NOFOLLOW)
@ -1234,7 +1232,7 @@ namespace Kernel
return BAN::Error::from_errno(EPERM);
}
TRY(inode->chmod(mode));
TRY(inode->chmod(mode & ~S_IFMASK));
return 0;
}