diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-05 18:17:06 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-05 18:17:06 +0200 |
commit | 76f2596ce8a8f1df4321b6a25a201b582387dfe2 (patch) | |
tree | 63df6669a2db3ac340cc109d33ea299a88ae5317 /Kernel/Syscalls/process.cpp | |
parent | 53aa01384d3dfe7fabccb823d6527879c54dd15e (diff) | |
download | serenity-76f2596ce8a8f1df4321b6a25a201b582387dfe2.zip |
Kernel: Use TRY() in sys$set_process_name()
Diffstat (limited to 'Kernel/Syscalls/process.cpp')
-rw-r--r-- | Kernel/Syscalls/process.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Kernel/Syscalls/process.cpp b/Kernel/Syscalls/process.cpp index 6c2e69cfe9..ea0a660a31 100644 --- a/Kernel/Syscalls/process.cpp +++ b/Kernel/Syscalls/process.cpp @@ -39,14 +39,12 @@ KResultOr<FlatPtr> Process::sys$set_process_name(Userspace<const char*> user_nam REQUIRE_PROMISE(proc); if (user_name_length > 256) return ENAMETOOLONG; - auto name_or_error = try_copy_kstring_from_user(user_name, user_name_length); - if (name_or_error.is_error()) - return name_or_error.error(); + auto name = TRY(try_copy_kstring_from_user(user_name, user_name_length)); // Empty and whitespace-only names only exist to confuse users. - if (name_or_error.value()->view().is_whitespace()) + if (name->view().is_whitespace()) return EINVAL; // FIXME: There's a String copy here. Process::m_name should be a KString. - m_name = name_or_error.value()->view(); + m_name = name->view(); return 0; } |