diff options
Diffstat (limited to 'Kernel/Syscalls/stat.cpp')
-rw-r--r-- | Kernel/Syscalls/stat.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Kernel/Syscalls/stat.cpp b/Kernel/Syscalls/stat.cpp index dc601d9f08..31d0cd9c6e 100644 --- a/Kernel/Syscalls/stat.cpp +++ b/Kernel/Syscalls/stat.cpp @@ -15,9 +15,7 @@ KResultOr<FlatPtr> Process::sys$fstat(int fd, Userspace<stat*> user_statbuf) { VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this) REQUIRE_PROMISE(stdio); - auto description = fds().file_description(fd); - if (!description) - return EBADF; + auto description = TRY(fds().file_description(fd)); stat buffer = {}; TRY(description->stat(buffer)); return copy_to_user(user_statbuf, &buffer); @@ -35,9 +33,7 @@ KResultOr<FlatPtr> Process::sys$stat(Userspace<const Syscall::SC_stat_params*> u if (params.dirfd == AT_FDCWD) { base = current_directory(); } else { - auto base_description = fds().file_description(params.dirfd); - if (!base_description) - return EBADF; + auto base_description = TRY(fds().file_description(params.dirfd)); if (!base_description->is_directory()) return ENOTDIR; if (!base_description->custody()) |