mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
Kernel: Remove the use of FileSystemPath in sys$realpath()
Now that VFS::resolve_path() canonicalizes paths automatically, we don't need to do that here anymore.
This commit is contained in:
parent
68aeefa49b
commit
064cd2278c
Notes:
sideshowbarker
2024-07-19 10:01:00 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/064cd2278cd Pull-request: https://github.com/SerenityOS/serenity/pull/1079 Reviewed-by: https://github.com/awesomekling
1 changed files with 3 additions and 9 deletions
|
@ -2578,18 +2578,12 @@ int Process::sys$realpath(const Syscall::SC_realpath_params* user_params)
|
|||
if (custody_or_error.is_error())
|
||||
return custody_or_error.error();
|
||||
auto& custody = custody_or_error.value();
|
||||
auto absolute_path = custody->absolute_path();
|
||||
|
||||
// FIXME: Once resolve_path is fixed to deal with .. and . , remove the use of FileSystemPath::canonical_path.
|
||||
FileSystemPath canonical_path(custody->absolute_path());
|
||||
if (!canonical_path.is_valid()) {
|
||||
dbg() << "FileSystemPath failed to canonicalize " << custody->absolute_path();
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
if (canonical_path.string().length() + 1 > params.buffer.size)
|
||||
if (absolute_path.length() + 1 > params.buffer.size)
|
||||
return -ENAMETOOLONG;
|
||||
|
||||
copy_to_user(params.buffer.data, canonical_path.string().characters(), canonical_path.string().length() + 1);
|
||||
copy_to_user(params.buffer.data, absolute_path.characters(), absolute_path.length() + 1);
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue