mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
VFS: Place new files in the correct subdirectory.
Oops, every new file was ending up in the root directory. Also make sure we create the inode in the same FS as the parent directory.
This commit is contained in:
parent
4d1d875ca7
commit
afccbe51a4
Notes:
sideshowbarker
2024-07-19 15:59:04 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/afccbe51a4a
1 changed files with 3 additions and 3 deletions
|
@ -169,8 +169,8 @@ RetainPtr<FileDescriptor> VFS::create(const String& path, int& error, int option
|
|||
}
|
||||
|
||||
InodeIdentifier parent_dir;
|
||||
auto existing_dir = resolve_path(path, base, error, 0, &parent_dir);
|
||||
if (existing_dir.is_valid()) {
|
||||
auto existing_file = resolve_path(path, base, error, 0, &parent_dir);
|
||||
if (existing_file.is_valid()) {
|
||||
error = -EEXIST;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ RetainPtr<FileDescriptor> VFS::create(const String& path, int& error, int option
|
|||
return nullptr;
|
||||
}
|
||||
dbgprintf("VFS::create_file: '%s' in %u:%u\n", p.basename().characters(), parent_dir.fsid(), parent_dir.index());
|
||||
auto new_file = base.fs()->create_inode(base.fs()->root_inode(), p.basename(), mode, 0, error);
|
||||
auto new_file = parent_dir.fs()->create_inode(parent_dir, p.basename(), mode, 0, error);
|
||||
if (!new_file)
|
||||
return nullptr;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue