mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
Kernel: Convert remaining users of copy_string_from_user()
This patch replaces the remaining users of this API with the new try_copy_kstring_from_user() instead. Note that we still convert to a String for continued processing, and I've added FIXME about continuing work on using KString all the way.
This commit is contained in:
parent
9509433e25
commit
0f6f863382
4 changed files with 21 additions and 15 deletions
|
@ -32,10 +32,11 @@ KResultOr<FlatPtr> Process::sys$sethostname(Userspace<const char*> buffer, size_
|
|||
if (length > 64)
|
||||
return ENAMETOOLONG;
|
||||
return hostname().with_exclusive([&](auto& name) -> KResultOr<FlatPtr> {
|
||||
auto copied_hostname = copy_string_from_user(buffer, length);
|
||||
if (copied_hostname.is_null())
|
||||
return EFAULT;
|
||||
name = move(copied_hostname);
|
||||
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();
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue