@@ -22,8 +22,8 @@ pub(crate) struct ReadDirInner {
22
22
}
23
23
24
24
impl ReadDirInner {
25
- pub ( crate ) fn new ( start : & fs:: File , path : & Path ) -> io:: Result < Self > {
26
- let dir = Dir :: from ( open_dir_for_reading ( start, path) ?) ?;
25
+ pub ( crate ) fn new ( start : & fs:: File , path : & Path , follow : FollowSymlinks ) -> io:: Result < Self > {
26
+ let dir = Dir :: from ( open_dir_for_reading ( start, path, follow ) ?) ?;
27
27
Ok ( Self {
28
28
raw_fd : dir. as_fd ( ) . as_raw_fd ( ) ,
29
29
rustix : Arc :: new ( Mutex :: new ( dir) ) ,
@@ -38,15 +38,20 @@ impl ReadDirInner {
38
38
let dir = Dir :: from ( open_dir_for_reading_unchecked (
39
39
start,
40
40
Component :: CurDir . as_ref ( ) ,
41
+ FollowSymlinks :: No ,
41
42
) ?) ?;
42
43
Ok ( Self {
43
44
raw_fd : dir. as_fd ( ) . as_raw_fd ( ) ,
44
45
rustix : Arc :: new ( Mutex :: new ( dir) ) ,
45
46
} )
46
47
}
47
48
48
- pub ( crate ) fn new_unchecked ( start : & fs:: File , path : & Path ) -> io:: Result < Self > {
49
- let dir = open_dir_for_reading_unchecked ( start, path) ?;
49
+ pub ( crate ) fn new_unchecked (
50
+ start : & fs:: File ,
51
+ path : & Path ,
52
+ follow : FollowSymlinks ,
53
+ ) -> io:: Result < Self > {
54
+ let dir = open_dir_for_reading_unchecked ( start, path, follow) ?;
50
55
Ok ( Self {
51
56
raw_fd : dir. as_fd ( ) . as_raw_fd ( ) ,
52
57
rustix : Arc :: new ( Mutex :: new ( Dir :: from ( dir) ?) ) ,
@@ -73,8 +78,12 @@ impl ReadDirInner {
73
78
Metadata :: from_file ( & self . as_file_view ( ) )
74
79
}
75
80
76
- pub ( super ) fn read_dir ( & self , file_name : & OsStr ) -> io:: Result < ReadDir > {
77
- read_dir_unchecked ( & self . as_file_view ( ) , file_name. as_ref ( ) )
81
+ pub ( super ) fn read_dir (
82
+ & self ,
83
+ file_name : & OsStr ,
84
+ follow : FollowSymlinks ,
85
+ ) -> io:: Result < ReadDir > {
86
+ read_dir_unchecked ( & self . as_file_view ( ) , file_name. as_ref ( ) , follow)
78
87
}
79
88
80
89
#[ allow( unsafe_code) ]
0 commit comments