summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-09-13 14:35:18 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-09-13 14:35:18 +0200
commit2d1f3ec749832822c00a9278161890918416e9be (patch)
tree446573c739dfc9ea7fc977ad015384c7ef568faa
parent7d85fc00e442e10944f00c7e6b814b48b54dff3e (diff)
downloadserenity-2d1f3ec749832822c00a9278161890918416e9be.zip
Kernel: fchdir() should fail for non-searchable directories
So sayeth POSIX.
-rw-r--r--Kernel/Process.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 4e92dbc4e3..ab6b87ff81 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -1211,6 +1211,9 @@ int Process::sys$fchdir(int fd)
if (!description->is_directory())
return -ENOTDIR;
+ if (!description->metadata().may_execute(*this))
+ return -EACCES;
+
m_cwd = description->custody();
return 0;
}