summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/get_dir_entries.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Syscalls/get_dir_entries.cpp')
-rw-r--r--Kernel/Syscalls/get_dir_entries.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/Kernel/Syscalls/get_dir_entries.cpp b/Kernel/Syscalls/get_dir_entries.cpp
index 2f98386858..6cbd6c6fc7 100644
--- a/Kernel/Syscalls/get_dir_entries.cpp
+++ b/Kernel/Syscalls/get_dir_entries.cpp
@@ -15,9 +15,7 @@ KResultOr<FlatPtr> Process::sys$get_dir_entries(int fd, Userspace<void*> user_bu
REQUIRE_PROMISE(stdio);
if (user_size > NumericLimits<ssize_t>::max())
return EINVAL;
- auto description = fds().file_description(fd);
- if (!description)
- return EBADF;
+ auto description = TRY(fds().file_description(fd));
auto buffer = UserOrKernelBuffer::for_user_buffer(user_buffer, static_cast<size_t>(user_size));
if (!buffer.has_value())
return EFAULT;