From b00799b9ce7f9e3c0c5642796b7bfb223168684b Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sat, 30 Jan 2021 06:25:52 +0100 Subject: Kernel: Make /proc/self/ work again I have no idea when it broke. Inspired by https://www.thanassis.space/bashheimer.html --- Kernel/FileSystem/ProcFS.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Kernel/FileSystem') diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index 2ed82dffd8..7aa5d4deed 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -1449,7 +1449,11 @@ ssize_t ProcFSInode::write_bytes(off_t offset, ssize_t size, const UserOrKernelB KResultOr> ProcFSInode::resolve_as_link(Custody& base, RefPtr* 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); -- cgit v1.2.3