mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 23:52:07 +00:00
Kernel: Use TRY() in sys$sethostname()
This commit is contained in:
parent
963f847579
commit
2d2ea05c97
1 changed files with 2 additions and 4 deletions
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue