1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 01:15:07 +00:00

Kernel: Port stat() to KResult/KResultOr<T>.

This commit is contained in:
Andreas Kling 2019-03-02 00:11:08 +01:00
parent f75eb9af16
commit 37f6844c6c
5 changed files with 31 additions and 40 deletions

View file

@ -1219,27 +1219,21 @@ int Process::sys$fstat(int fd, stat* statbuf)
auto* descriptor = file_descriptor(fd);
if (!descriptor)
return -EBADF;
return descriptor->fstat(statbuf);
return descriptor->fstat(*statbuf);
}
int Process::sys$lstat(const char* path, stat* statbuf)
{
if (!validate_write_typed(statbuf))
return -EFAULT;
int error;
if (!VFS::the().stat(move(path), error, O_NOFOLLOW_NOERROR, cwd_inode(), *statbuf))
return error;
return 0;
return VFS::the().stat(String(path), O_NOFOLLOW_NOERROR, cwd_inode(), *statbuf);
}
int Process::sys$stat(const char* path, stat* statbuf)
{
if (!validate_write_typed(statbuf))
return -EFAULT;
int error;
if (!VFS::the().stat(move(path), error, 0, cwd_inode(), *statbuf))
return error;
return 0;
return VFS::the().stat(String(path), O_NOFOLLOW_NOERROR, cwd_inode(), *statbuf);
}
int Process::sys$readlink(const char* path, char* buffer, ssize_t size)