Kernel: Make /proc/self/ work again

I have no idea when it broke.

Inspired by https://www.thanassis.space/bashheimer.html
This commit is contained in:
Ben Wiederhake 2021-01-30 06:25:52 +01:00 committed by Andreas Kling
parent e313323317
commit b00799b9ce

View file

@ -1449,7 +1449,11 @@ ssize_t ProcFSInode::write_bytes(off_t offset, ssize_t size, const UserOrKernelB
KResultOr<NonnullRefPtr<Custody>> ProcFSInode::resolve_as_link(Custody& base, RefPtr<Custody>* out_parent, int options, int symlink_recursion_level) const
{
// The only links are in pid directories, so it's safe to ignore
if (FI_Root_self == to_proc_file_type(identifier())) {
return VFS::the().resolve_path(String::number(Process::current()->pid().value()), base, out_parent, options, symlink_recursion_level);
}
// The only other links are in pid directories, so it's safe to ignore
// unrelated files and the thread-specific stacks/ directory.
if (!is_process_related_file(identifier()))
return Inode::resolve_as_link(base, out_parent, options, symlink_recursion_level);