diff options
Diffstat (limited to 'Kernel/Syscalls/ttyname.cpp')
-rw-r--r-- | Kernel/Syscalls/ttyname.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Kernel/Syscalls/ttyname.cpp b/Kernel/Syscalls/ttyname.cpp index 5e795d9ff6..1b0cb09309 100644 --- a/Kernel/Syscalls/ttyname.cpp +++ b/Kernel/Syscalls/ttyname.cpp @@ -15,9 +15,7 @@ KResultOr<FlatPtr> Process::sys$ttyname(int fd, Userspace<char*> buffer, size_t { VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this) REQUIRE_PROMISE(tty); - auto description = fds().file_description(fd); - if (!description) - return EBADF; + auto description = TRY(fds().file_description(fd)); if (!description->is_tty()) return ENOTTY; auto tty_name = description->tty()->tty_name(); @@ -30,9 +28,7 @@ KResultOr<FlatPtr> Process::sys$ptsname(int fd, Userspace<char*> buffer, size_t { VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this) REQUIRE_PROMISE(tty); - auto description = fds().file_description(fd); - if (!description) - return EBADF; + auto description = TRY(fds().file_description(fd)); auto* master_pty = description->master_pty(); if (!master_pty) return ENOTTY; |