mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
Fix bug where you couldn't "cd .." into the root of a mounted fs.
This commit is contained in:
parent
a32b3a3ddf
commit
edb81a635c
2 changed files with 6 additions and 7 deletions
|
@ -64,8 +64,6 @@ bool ProcFileSystem::initialize()
|
|||
{
|
||||
SyntheticFileSystem::initialize();
|
||||
|
||||
auto d = addFile(createDirectory("sys"));
|
||||
|
||||
addFile(createGeneratedFile("summary", [] {
|
||||
InterruptDisabler disabler;
|
||||
auto tasks = Task::allTasks();
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue