This commit is contained in:
+6
-5
@@ -328,14 +328,15 @@ impl VfsView<'_> {
|
||||
|
||||
async fn native_directory_entries(&mut self, fd: Resource<types::Descriptor>) -> FsResult<Vec<DirectoryEntry>> {
|
||||
let stream = HostDescriptor::read_directory(&mut self.inner, fd).await?;
|
||||
let stream_rep = stream.rep();
|
||||
let mut entries = Vec::new();
|
||||
loop {
|
||||
match HostDirectoryEntryStream::read_directory_entry(&mut self.inner, stream.clone()).await? {
|
||||
match HostDirectoryEntryStream::read_directory_entry(&mut self.inner, Resource::new_borrow(stream_rep)).await? {
|
||||
Some(entry) => entries.push(entry),
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
HostDirectoryEntryStream::drop(&mut self.inner, stream)?;
|
||||
HostDirectoryEntryStream::drop(&mut self.inner, stream).map_err(|_| ErrorCode::Io)?;
|
||||
Ok(entries)
|
||||
}
|
||||
|
||||
@@ -587,11 +588,11 @@ impl HostDescriptor for VfsView<'_> {
|
||||
None => {
|
||||
let child_path = self.state.dirs.get(&fd.rep()).map(|base| join(base, &path));
|
||||
let opened = HostDescriptor::open_at(&mut self.inner, fd, path_flags, path, oflags, flags).await?;
|
||||
if let Some(path) = child_path
|
||||
&& HostDescriptor::get_type(&mut self.inner, opened.clone()).await? == DescriptorType::Directory
|
||||
{
|
||||
if let Some(path) = child_path {
|
||||
if HostDescriptor::get_type(&mut self.inner, Resource::new_borrow(opened.rep())).await? == DescriptorType::Directory {
|
||||
self.state.dirs.insert(opened.rep(), path);
|
||||
}
|
||||
}
|
||||
Ok(opened)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user