summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-10-26 18:19:31 +0200
committerAndreas Kling <awesomekling@gmail.com>2018-10-26 18:19:31 +0200
commitedb81a635c1d1fc3fcf197aedc6a9283f128acbc (patch)
tree694cf02e20c868947f488ba0383b8902bdd60913
parenta32b3a3ddfcbb7b8369db983892fef0bef54c275 (diff)
downloadserenity-edb81a635c1d1fc3fcf197aedc6a9283f128acbc.zip
Fix bug where you couldn't "cd .." into the root of a mounted fs.
-rw-r--r--Kernel/ProcFileSystem.cpp2
-rw-r--r--VirtualFileSystem/VirtualFileSystem.cpp11
2 files changed, 6 insertions, 7 deletions
diff --git a/Kernel/ProcFileSystem.cpp b/Kernel/ProcFileSystem.cpp
index cbe119a5ac..eba70ba1a7 100644
--- a/Kernel/ProcFileSystem.cpp
+++ b/Kernel/ProcFileSystem.cpp
@@ -64,8 +64,6 @@ bool ProcFileSystem::initialize()
{
SyntheticFileSystem::initialize();
- auto d = addFile(createDirectory("sys"));
-
addFile(createGeneratedFile("summary", [] {
InterruptDisabler disabler;
auto tasks = Task::allTasks();
diff --git a/VirtualFileSystem/VirtualFileSystem.cpp b/VirtualFileSystem/VirtualFileSystem.cpp
index ba60b8d4ea..3b5a2ccd7f 100644
--- a/VirtualFileSystem/VirtualFileSystem.cpp
+++ b/VirtualFileSystem/VirtualFileSystem.cpp
@@ -413,29 +413,30 @@ InodeIdentifier VirtualFileSystem::resolvePath(const String& path, Node* base)
inode = base ? base->inode : m_rootNode->inode;
for (unsigned i = 0; i < parts.size(); ++i) {
+ bool wasRootInodeAtHeadOfLoop = inode.isRootInode();
auto& part = parts[i];
auto metadata = inode.metadata();
if (!metadata.isValid()) {
#ifdef VFS_DEBUG
kprintf("invalid metadata\n");
#endif
- return InodeIdentifier();
+ return { };
}
if (!metadata.isDirectory()) {
#ifdef VFS_DEBUG
kprintf("not directory\n");
#endif
- return InodeIdentifier();
+ return { };
}
inode = inode.fileSystem()->childOfDirectoryInodeWithName(inode, part);
if (!inode.isValid()) {
#ifdef VFS_DEBUG
kprintf("bad child\n");
#endif
- return InodeIdentifier();
+ return { };
}
#ifdef VFS_DEBUG
- kprintf("<%s> %02u:%08u\n", part.characters(), inode.fileSystemID(), inode.index());
+ kprintf("<%s> %u:%u\n", part.characters(), inode.fileSystemID(), inode.index());
#endif
if (auto mount = findMountForHost(inode)) {
#ifdef VFS_DEBUG
@@ -443,7 +444,7 @@ InodeIdentifier VirtualFileSystem::resolvePath(const String& path, Node* base)
#endif
inode = mount->guest();
}
- if (inode.isRootInode() && !isRoot(inode) && part == "..") {
+ if (wasRootInodeAtHeadOfLoop && inode.isRootInode() && !isRoot(inode) && part == "..") {
#ifdef VFS_DEBUG
kprintf(" -- is guest\n");
#endif