1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:57:42 +00:00

Kernel: Make realpath() take path+length, get rid of SmapDisabler

This commit is contained in:
Andreas Kling 2020-01-06 11:32:25 +01:00
parent d6b06fd5a3
commit 7c916b9fe9
4 changed files with 29 additions and 13 deletions

View file

@ -704,10 +704,15 @@ uint32_t arc4random_uniform(uint32_t max_bounds)
char* realpath(const char* pathname, char* buffer)
{
if (!pathname) {
errno = EFAULT;
return nullptr;
}
size_t size = PATH_MAX;
if (buffer == nullptr)
buffer = (char*)malloc(size);
int rc = syscall(SC_realpath, pathname, buffer, size);
Syscall::SC_realpath_params params { pathname, strlen(pathname), buffer, size };
int rc = syscall(SC_realpath, &params);
if (rc < 0) {
errno = -rc;
return nullptr;