mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 22:38:51 +00:00
Fix bug where you couldn't "cd .." into the root of a mounted fs.
This commit is contained in:
parent
a32b3a3ddf
commit
edb81a635c
Notes:
sideshowbarker
2024-07-19 18:38:07 +09:00
Author: https://github.com/awesomekling
Commit: edb81a635c
2 changed files with 6 additions and 7 deletions
|
@ -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
Add a link
Reference in a new issue