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