@@ -22,8 +22,8 @@ pub(crate) struct ReadDirInner {
2222}
2323
2424impl 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 ) ?) ?;
2727 Ok ( Self {
2828 raw_fd : dir. as_fd ( ) . as_raw_fd ( ) ,
2929 rustix : Arc :: new ( Mutex :: new ( dir) ) ,
@@ -38,15 +38,20 @@ impl ReadDirInner {
3838 let dir = Dir :: from ( open_dir_for_reading_unchecked (
3939 start,
4040 Component :: CurDir . as_ref ( ) ,
41+ FollowSymlinks :: No ,
4142 ) ?) ?;
4243 Ok ( Self {
4344 raw_fd : dir. as_fd ( ) . as_raw_fd ( ) ,
4445 rustix : Arc :: new ( Mutex :: new ( dir) ) ,
4546 } )
4647 }
4748
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) ?;
5055 Ok ( Self {
5156 raw_fd : dir. as_fd ( ) . as_raw_fd ( ) ,
5257 rustix : Arc :: new ( Mutex :: new ( Dir :: from ( dir) ?) ) ,
@@ -73,8 +78,12 @@ impl ReadDirInner {
7378 Metadata :: from_file ( & self . as_file_view ( ) )
7479 }
7580
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)
7887 }
7988
8089 #[ allow( unsafe_code) ]
0 commit comments