From 88b6428c25ea046a4bb19bb6f3f68dd4f1439539 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 10 Nov 2021 11:55:37 +0100 Subject: AK: Make Vector::try_* functions return ErrorOr Instead of signalling allocation failure with a bool return value (false), we now use ErrorOr and return ENOMEM as appropriate. This allows us to use TRY() and MUST() with Vector. :^) --- Kernel/Syscalls/read.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Kernel/Syscalls/read.cpp') diff --git a/Kernel/Syscalls/read.cpp b/Kernel/Syscalls/read.cpp index c3e8700aa7..4dc7b0d15a 100644 --- a/Kernel/Syscalls/read.cpp +++ b/Kernel/Syscalls/read.cpp @@ -50,8 +50,7 @@ ErrorOr Process::sys$readv(int fd, Userspace iov, u64 total_length = 0; Vector vecs; - if (!vecs.try_resize(iov_count)) - return ENOMEM; + TRY(vecs.try_resize(iov_count)); TRY(copy_n_from_user(vecs.data(), iov, iov_count)); for (auto& vec : vecs) { total_length += vec.iov_len; -- cgit v1.2.3