mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 11:07:45 +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;
|
int arg_fd = (int)arg;
|
||||||
if (arg_fd < 0)
|
if (arg_fd < 0)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
auto new_fd_or_error = fds().allocate(arg_fd);
|
auto fd_allocation = TRY(m_fds.allocate(arg_fd));
|
||||||
if (new_fd_or_error.is_error())
|
m_fds[fd_allocation.fd].set(*description);
|
||||||
return new_fd_or_error.error();
|
return fd_allocation.fd;
|
||||||
auto new_fd = new_fd_or_error.release_value();
|
|
||||||
m_fds[new_fd.fd].set(*description);
|
|
||||||
return new_fd.fd;
|
|
||||||
}
|
}
|
||||||
case F_GETFD:
|
case F_GETFD:
|
||||||
return m_fds[fd].flags();
|
return m_fds[fd].flags();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue