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:
parent
f75eb9af16
commit
37f6844c6c
5 changed files with 31 additions and 40 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue