From cd5b351ce4400cb16e68e7f1b2b43a9ba0827eb9 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 29 May 2025 03:21:01 +0300 Subject: [PATCH] Kernel: Fix fchmodat mode handling Ignore file type bits instead of returning EINVAL if they are set --- kernel/kernel/Process.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/kernel/Process.cpp b/kernel/kernel/Process.cpp index 0d3d4fc1..f9b2d1c2 100644 --- a/kernel/kernel/Process.cpp +++ b/kernel/kernel/Process.cpp @@ -1217,8 +1217,6 @@ namespace Kernel BAN::ErrorOr 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; }