summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Syscalls/hostname.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/Kernel/Syscalls/hostname.cpp b/Kernel/Syscalls/hostname.cpp
index 69f2132e3f..7dd259522a 100644
--- a/Kernel/Syscalls/hostname.cpp
+++ b/Kernel/Syscalls/hostname.cpp
@@ -30,12 +30,10 @@ KResultOr<FlatPtr> Process::sys$sethostname(Userspace<const char*> buffer, size_
return EPERM;
if (length > 64)
return ENAMETOOLONG;
+ auto new_name = TRY(try_copy_kstring_from_user(buffer, length));
return hostname().with_exclusive([&](auto& name) -> KResultOr<FlatPtr> {
- auto name_or_error = try_copy_kstring_from_user(buffer, length);
- if (name_or_error.is_error())
- return name_or_error.error();
// FIXME: Use KString instead of String here.
- name = name_or_error.value()->view();
+ name = new_name->view();
return 0;
});
}