Skip to content

Commit 7cf0a48

Browse files
committed
std: Handle DT_DIR file types in dirent pointers
This "fast path" in `DirEntry::file_type` on Unix wasn't turning out to be so much of a fast path as the `DT_DIR` case wasn't handled, so directories fell back to using `lstat` instead. This commit adds the missing case to return quickly if a path is a directory and `DirEntry::file_type` is used.
1 parent c322dbb commit 7cf0a48

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/rt/rust_builtin.c

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ rust_dir_get_mode(struct dirent* entry_ptr) {
5858
case DT_LNK: return S_IFLNK;
5959
case DT_REG: return S_IFREG;
6060
case DT_SOCK: return S_IFSOCK;
61+
case DT_DIR: return S_IFDIR;
6162
}
6263
#endif
6364
return -1;

0 commit comments

Comments
 (0)