diff options
Diffstat (limited to 'Kernel/Syscalls/write.cpp')
-rw-r--r-- | Kernel/Syscalls/write.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/Kernel/Syscalls/write.cpp b/Kernel/Syscalls/write.cpp index 4329666d3c..aaec7dc66f 100644 --- a/Kernel/Syscalls/write.cpp +++ b/Kernel/Syscalls/write.cpp @@ -33,10 +33,7 @@ KResultOr<FlatPtr> Process::sys$writev(int fd, Userspace<const struct iovec*> io return EINVAL; } - auto description = fds().file_description(fd); - if (!description) - return EBADF; - + auto description = TRY(fds().file_description(fd)); if (!description->is_writable()) return EBADF; @@ -104,9 +101,7 @@ KResultOr<FlatPtr> Process::sys$write(int fd, Userspace<const u8*> data, size_t return EINVAL; dbgln_if(IO_DEBUG, "sys$write({}, {}, {})", fd, data.ptr(), size); - auto description = fds().file_description(fd); - if (!description) - return EBADF; + auto description = TRY(fds().file_description(fd)); if (!description->is_writable()) return EBADF; |