1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:05:08 +00:00

Kernel: Pass a parameter struct to chown()

This commit is contained in:
Andreas Kling 2020-01-11 10:17:08 +01:00
parent 29b3d95004
commit 6536a80aa9
4 changed files with 21 additions and 6 deletions

View file

@ -2640,12 +2640,16 @@ int Process::sys$fchown(int fd, uid_t uid, gid_t gid)
return description->chown(uid, gid);
}
int Process::sys$chown(const char* pathname, uid_t uid, gid_t gid)
int Process::sys$chown(const Syscall::SC_chown_params* user_params)
{
SmapDisabler disabler;
if (!validate_read_str(pathname))
if (!validate_read_typed(user_params))
return -EFAULT;
return VFS::the().chown(StringView(pathname), uid, gid, current_directory());
Syscall::SC_chown_params params;
copy_from_user(&params, user_params, sizeof(params));
auto path = get_syscall_path_argument(params.path.characters, params.path.length);
if (path.is_error())
return path.error();
return VFS::the().chown(path.value(), params.uid, params.gid, current_directory());
}
void Process::finalize()