1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +00:00

Kernel: Make access() take path+length

Also, let's return EFAULT for nullptr at the LibC layer. We can't do
all bad addresses this way, but we can at least do null. :^)
This commit is contained in:
Andreas Kling 2020-01-06 10:43:53 +01:00
parent ad4284428a
commit 642137f014
3 changed files with 10 additions and 6 deletions

View file

@ -1444,12 +1444,12 @@ int Process::sys$utime(const char* pathname, const utimbuf* buf)
return VFS::the().utime(StringView(pathname), current_directory(), atime, mtime);
}
int Process::sys$access(const char* pathname, int mode)
int Process::sys$access(const char* user_path, size_t path_length, int mode)
{
SmapDisabler disabler;
if (!validate_read_str(pathname))
if (!validate_read_str(user_path))
return -EFAULT;
return VFS::the().access(StringView(pathname), mode, current_directory());
auto path = copy_string_from_user(user_path, path_length);
return VFS::the().access(path, mode, current_directory());
}
int Process::sys$fcntl(int fd, int cmd, u32 arg)