1
Fork 0
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:
Andreas Kling 2021-09-05 16:14:34 +02:00
parent c767e20f91
commit 29bafec43b

View file

@ -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();