mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:48:14 +00:00
Kernel: Use is_error() in sys$fcntl()
This commit is contained in:
parent
c767e20f91
commit
29bafec43b
1 changed files with 3 additions and 6 deletions
|
@ -25,12 +25,9 @@ KResultOr<FlatPtr> Process::sys$fcntl(int fd, int cmd, u32 arg)
|
|||
int arg_fd = (int)arg;
|
||||
if (arg_fd < 0)
|
||||
return EINVAL;
|
||||
auto new_fd_or_error = fds().allocate(arg_fd);
|
||||
if (new_fd_or_error.is_error())
|
||||
return new_fd_or_error.error();
|
||||
auto new_fd = new_fd_or_error.release_value();
|
||||
m_fds[new_fd.fd].set(*description);
|
||||
return new_fd.fd;
|
||||
auto fd_allocation = TRY(m_fds.allocate(arg_fd));
|
||||
m_fds[fd_allocation.fd].set(*description);
|
||||
return fd_allocation.fd;
|
||||
}
|
||||
case F_GETFD:
|
||||
return m_fds[fd].flags();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue