mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:58:11 +00:00
Kernel: Make Process::FileDescriptions::allocate return KResultOr<int>
Modernize more error checking by utilizing KResultOr.
This commit is contained in:
parent
d2cee9cbf6
commit
ba03b6ad02
10 changed files with 48 additions and 37 deletions
|
@ -45,10 +45,11 @@ KResultOr<FlatPtr> Process::sys$open(Userspace<const Syscall::SC_open_params*> u
|
|||
return path.error();
|
||||
|
||||
dbgln_if(IO_DEBUG, "sys$open(dirfd={}, path='{}', options={}, mode={})", dirfd, path.value()->view(), options, mode);
|
||||
int fd = m_fds.allocate();
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
auto fd_or_error = m_fds.allocate();
|
||||
if (fd_or_error.is_error())
|
||||
return fd_or_error.error();
|
||||
auto fd = fd_or_error.value();
|
||||
RefPtr<Custody> base;
|
||||
if (dirfd == AT_FDCWD) {
|
||||
base = current_directory();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue