mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
Kernel: Convert Process::get_syscall_path_argument() to KString
This API now returns a KResultOr<NonnullOwnPtr<KString>> and allocation failures should be propagated everywhere nicely. :^)
This commit is contained in:
parent
66f3ec687b
commit
1123af361d
25 changed files with 42 additions and 42 deletions
|
@ -434,19 +434,19 @@ Custody& Process::current_directory()
|
|||
return *m_cwd;
|
||||
}
|
||||
|
||||
KResultOr<String> Process::get_syscall_path_argument(const char* user_path, size_t path_length) const
|
||||
KResultOr<NonnullOwnPtr<KString>> Process::get_syscall_path_argument(char const* user_path, size_t path_length) const
|
||||
{
|
||||
if (path_length == 0)
|
||||
return EINVAL;
|
||||
if (path_length > PATH_MAX)
|
||||
return ENAMETOOLONG;
|
||||
auto copied_string = copy_string_from_user(user_path, path_length);
|
||||
if (copied_string.is_null())
|
||||
return EFAULT;
|
||||
return copied_string;
|
||||
auto string_or_error = try_copy_kstring_from_user(user_path, path_length);
|
||||
if (string_or_error.is_error())
|
||||
return string_or_error.error();
|
||||
return string_or_error.release_value();
|
||||
}
|
||||
|
||||
KResultOr<String> Process::get_syscall_path_argument(const Syscall::StringArgument& path) const
|
||||
KResultOr<NonnullOwnPtr<KString>> Process::get_syscall_path_argument(Syscall::StringArgument const& path) const
|
||||
{
|
||||
return get_syscall_path_argument(path.characters, path.length);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue