summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2021-01-30 06:25:52 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-31 12:03:14 +0100
commitb00799b9ce7f9e3c0c5642796b7bfb223168684b (patch)
treef98072b69b8c18e3f4d92384d776e11371fac6c8 /Kernel/FileSystem
parente313323317ea06b4d86a2b037b88123f522ba5bd (diff)
downloadserenity-b00799b9ce7f9e3c0c5642796b7bfb223168684b.zip
Kernel: Make /proc/self/ work again
I have no idea when it broke. Inspired by https://www.thanassis.space/bashheimer.html
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r--Kernel/FileSystem/ProcFS.cpp6
1 files changed, 5 insertions, 1 deletions
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<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);