mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +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
2 changed files with 6 additions and 7 deletions
|
@ -64,8 +64,6 @@ bool ProcFileSystem::initialize()
|
||||||
{
|
{
|
||||||
SyntheticFileSystem::initialize();
|
SyntheticFileSystem::initialize();
|
||||||
|
|
||||||
auto d = addFile(createDirectory("sys"));
|
|
||||||
|
|
||||||
addFile(createGeneratedFile("summary", [] {
|
addFile(createGeneratedFile("summary", [] {
|
||||||
InterruptDisabler disabler;
|
InterruptDisabler disabler;
|
||||||
auto tasks = Task::allTasks();
|
auto tasks = Task::allTasks();
|
||||||
|
|
|
@ -413,29 +413,30 @@ InodeIdentifier VirtualFileSystem::resolvePath(const String& path, Node* base)
|
||||||
inode = base ? base->inode : m_rootNode->inode;
|
inode = base ? base->inode : m_rootNode->inode;
|
||||||
|
|
||||||
for (unsigned i = 0; i < parts.size(); ++i) {
|
for (unsigned i = 0; i < parts.size(); ++i) {
|
||||||
|
bool wasRootInodeAtHeadOfLoop = inode.isRootInode();
|
||||||
auto& part = parts[i];
|
auto& part = parts[i];
|
||||||
auto metadata = inode.metadata();
|
auto metadata = inode.metadata();
|
||||||
if (!metadata.isValid()) {
|
if (!metadata.isValid()) {
|
||||||
#ifdef VFS_DEBUG
|
#ifdef VFS_DEBUG
|
||||||
kprintf("invalid metadata\n");
|
kprintf("invalid metadata\n");
|
||||||
#endif
|
#endif
|
||||||
return InodeIdentifier();
|
return { };
|
||||||
}
|
}
|
||||||
if (!metadata.isDirectory()) {
|
if (!metadata.isDirectory()) {
|
||||||
#ifdef VFS_DEBUG
|
#ifdef VFS_DEBUG
|
||||||
kprintf("not directory\n");
|
kprintf("not directory\n");
|
||||||
#endif
|
#endif
|
||||||
return InodeIdentifier();
|
return { };
|
||||||
}
|
}
|
||||||
inode = inode.fileSystem()->childOfDirectoryInodeWithName(inode, part);
|
inode = inode.fileSystem()->childOfDirectoryInodeWithName(inode, part);
|
||||||
if (!inode.isValid()) {
|
if (!inode.isValid()) {
|
||||||
#ifdef VFS_DEBUG
|
#ifdef VFS_DEBUG
|
||||||
kprintf("bad child\n");
|
kprintf("bad child\n");
|
||||||
#endif
|
#endif
|
||||||
return InodeIdentifier();
|
return { };
|
||||||
}
|
}
|
||||||
#ifdef VFS_DEBUG
|
#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
|
#endif
|
||||||
if (auto mount = findMountForHost(inode)) {
|
if (auto mount = findMountForHost(inode)) {
|
||||||
#ifdef VFS_DEBUG
|
#ifdef VFS_DEBUG
|
||||||
|
@ -443,7 +444,7 @@ InodeIdentifier VirtualFileSystem::resolvePath(const String& path, Node* base)
|
||||||
#endif
|
#endif
|
||||||
inode = mount->guest();
|
inode = mount->guest();
|
||||||
}
|
}
|
||||||
if (inode.isRootInode() && !isRoot(inode) && part == "..") {
|
if (wasRootInodeAtHeadOfLoop && inode.isRootInode() && !isRoot(inode) && part == "..") {
|
||||||
#ifdef VFS_DEBUG
|
#ifdef VFS_DEBUG
|
||||||
kprintf(" -- is guest\n");
|
kprintf(" -- is guest\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue