1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 23:24:57 +00:00

Kernel: Propagate a few KResults properly in FileSystem subsystems

Propagating un-obsevered KResults up the stack.
This commit is contained in:
Brian Gianforcaro 2020-08-05 02:07:31 -07:00 committed by Andreas Kling
parent c4c6d9367d
commit d67069d922
5 changed files with 20 additions and 8 deletions

View file

@ -191,9 +191,9 @@ bool VFS::is_vfs_root(InodeIdentifier inode) const
return inode == root_inode_id();
}
void VFS::traverse_directory_inode(Inode& dir_inode, Function<bool(const FS::DirectoryEntry&)> callback)
KResult VFS::traverse_directory_inode(Inode& dir_inode, Function<bool(const FS::DirectoryEntry&)> callback)
{
dir_inode.traverse_as_directory([&](const FS::DirectoryEntry& entry) {
return dir_inode.traverse_as_directory([&](const FS::DirectoryEntry& entry) {
InodeIdentifier resolved_inode;
if (auto mount = find_mount_for_host(entry.inode))
resolved_inode = mount->guest().identifier();
@ -329,7 +329,9 @@ KResultOr<NonnullRefPtr<FileDescription>> VFS::open(StringView path, int options
return KResult(-EROFS);
if (should_truncate_file) {
inode.truncate(0);
KResult result = inode.truncate(0);
if (result.is_error())
return result;
inode.set_mtime(kgettimeofday().tv_sec);
}
auto description = FileDescription::create(custody);