Skip to content

Commit 064cd22

Browse files
bugaevcawesomekling
authored andcommitted
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.
1 parent 68aeefa commit 064cd22

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

Kernel/Process.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2578,18 +2578,12 @@ int Process::sys$realpath(const Syscall::SC_realpath_params* user_params)
25782578
if (custody_or_error.is_error())
25792579
return custody_or_error.error();
25802580
auto& custody = custody_or_error.value();
2581+
auto absolute_path = custody->absolute_path();
25812582

2582-
// FIXME: Once resolve_path is fixed to deal with .. and . , remove the use of FileSystemPath::canonical_path.
2583-
FileSystemPath canonical_path(custody->absolute_path());
2584-
if (!canonical_path.is_valid()) {
2585-
dbg() << "FileSystemPath failed to canonicalize " << custody->absolute_path();
2586-
ASSERT_NOT_REACHED();
2587-
}
2588-
2589-
if (canonical_path.string().length() + 1 > params.buffer.size)
2583+
if (absolute_path.length() + 1 > params.buffer.size)
25902584
return -ENAMETOOLONG;
25912585

2592-
copy_to_user(params.buffer.data, canonical_path.string().characters(), canonical_path.string().length() + 1);
2586+
copy_to_user(params.buffer.data, absolute_path.characters(), absolute_path.length() + 1);
25932587
return 0;
25942588
};
25952589

0 commit comments

Comments
 (0)