@@ -15,7 +15,7 @@ use os::unix::prelude::*;
15
15
use ffi:: { CString , CStr , OsString , OsStr } ;
16
16
use fmt;
17
17
use io:: { self , Error , ErrorKind , SeekFrom } ;
18
- use libc:: { self , dirent , c_int, mode_t} ;
18
+ use libc:: { self , c_int, mode_t} ;
19
19
use mem;
20
20
use path:: { Path , PathBuf } ;
21
21
use ptr;
@@ -26,10 +26,12 @@ use sys::{cvt, cvt_r};
26
26
use sys_common:: { AsInner , FromInner } ;
27
27
28
28
#[ cfg( target_os = "linux" ) ]
29
- use libc:: { stat64, fstat64, lstat64, off64_t, ftruncate64, lseek64} ;
29
+ use libc:: { stat64, fstat64, lstat64, off64_t, ftruncate64, lseek64, dirent64 , readdir64_r } ;
30
30
#[ cfg( not( target_os = "linux" ) ) ]
31
31
use libc:: { stat as stat64, fstat as fstat64, lstat as lstat64, off_t as off64_t,
32
- ftruncate as ftruncate64, lseek as lseek64} ;
32
+ ftruncate as ftruncate64, lseek as lseek64, dirent as dirent64} ;
33
+ #[ cfg( not( any( target_os = "linux" , target_os = "solaris" ) ) ) ]
34
+ use libc:: { readdir_r as readdir64_r} ;
33
35
34
36
pub struct File ( FileDesc ) ;
35
37
@@ -49,7 +51,7 @@ unsafe impl Send for Dir {}
49
51
unsafe impl Sync for Dir { }
50
52
51
53
pub struct DirEntry {
52
- entry : dirent ,
54
+ entry : dirent64 ,
53
55
root : Arc < PathBuf > ,
54
56
// We need to store an owned copy of the directory name
55
57
// on Solaris because a) it uses a zero-length array to
@@ -224,7 +226,7 @@ impl Iterator for ReadDir {
224
226
} ;
225
227
let mut entry_ptr = ptr:: null_mut ( ) ;
226
228
loop {
227
- if libc :: readdir_r ( self . dirp . 0 , & mut ret. entry , & mut entry_ptr) != 0 {
229
+ if readdir64_r ( self . dirp . 0 , & mut ret. entry , & mut entry_ptr) != 0 {
228
230
return Some ( Err ( Error :: last_os_error ( ) ) )
229
231
}
230
232
if entry_ptr. is_null ( ) {
0 commit comments