Kernel: Fix fchmodat mode handling
Ignore file type bits instead of returning EINVAL if they are set
This commit is contained in:
parent
50024fbf8b
commit
cd5b351ce4
|
@ -1217,8 +1217,6 @@ namespace Kernel
|
||||||
|
|
||||||
BAN::ErrorOr<long> Process::sys_fchmodat(int fd, const char* path, mode_t mode, int flag)
|
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)
|
if (flag & ~AT_SYMLINK_NOFOLLOW)
|
||||||
return BAN::Error::from_errno(EINVAL);
|
return BAN::Error::from_errno(EINVAL);
|
||||||
if (flag == AT_SYMLINK_NOFOLLOW)
|
if (flag == AT_SYMLINK_NOFOLLOW)
|
||||||
|
@ -1234,7 +1232,7 @@ namespace Kernel
|
||||||
return BAN::Error::from_errno(EPERM);
|
return BAN::Error::from_errno(EPERM);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRY(inode->chmod(mode));
|
TRY(inode->chmod(mode & ~S_IFMASK));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue