Skip to content

Commit a2a9878

Browse files
committed
Hermit: Filter out . and .. from getdents64
While Hermit does not return these yet, it will do so in the future.
1 parent bf6c718 commit a2a9878

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

library/std/src/sys/fs/hermit.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ impl Iterator for ReadDir {
265265
// d_name is guaranteed to be null-terminated.
266266
let name = unsafe { CStr::from_ptr((&raw const (*entry_ptr).d_name).cast()) };
267267
let name_bytes = name.to_bytes();
268+
if name_bytes == b"." || name_bytes == b".." {
269+
continue;
270+
}
268271

269272
return Some(Ok(DirEntry {
270273
dir: Arc::clone(&self.inner),

0 commit comments

Comments
 (0)