File tree 2 files changed +2
-23
lines changed
2 files changed +2
-23
lines changed Original file line number Diff line number Diff line change @@ -529,7 +529,7 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
529
529
let p = cstr ( p) ?;
530
530
let mut stat: stat64 = unsafe { mem:: zeroed ( ) } ;
531
531
cvt ( unsafe {
532
- libc:: lstat ( p. as_ptr ( ) , & mut stat as * mut _ as * mut _ )
532
+ libc:: stat ( p. as_ptr ( ) , & mut stat as * mut _ as * mut _ )
533
533
} ) ?;
534
534
Ok ( FileAttr { stat } )
535
535
}
Original file line number Diff line number Diff line change @@ -287,28 +287,7 @@ pub fn temp_dir() -> PathBuf {
287
287
}
288
288
289
289
pub fn home_dir ( ) -> Option < PathBuf > {
290
- return crate :: env:: var_os ( "HOME" ) . or_else ( || unsafe {
291
- fallback ( )
292
- } ) . map ( PathBuf :: from) ;
293
-
294
- unsafe fn fallback ( ) -> Option < OsString > {
295
- let amt = match libc:: sysconf ( libc:: _SC_GETPW_R_SIZE_MAX) {
296
- n if n < 0 => 512 as usize ,
297
- n => n as usize ,
298
- } ;
299
- let mut buf = Vec :: with_capacity ( amt) ;
300
- let mut passwd: libc:: passwd = mem:: zeroed ( ) ;
301
- let mut result = ptr:: null_mut ( ) ;
302
- match libc:: getpwuid_r ( libc:: getuid ( ) , & mut passwd, buf. as_mut_ptr ( ) ,
303
- buf. capacity ( ) , & mut result) {
304
- 0 if !result. is_null ( ) => {
305
- let ptr = passwd. pw_dir as * const _ ;
306
- let bytes = CStr :: from_ptr ( ptr) . to_bytes ( ) . to_vec ( ) ;
307
- Some ( OsStringExt :: from_vec ( bytes) )
308
- } ,
309
- _ => None ,
310
- }
311
- }
290
+ None
312
291
}
313
292
314
293
pub fn exit ( code : i32 ) -> ! {
You can’t perform that action at this time.
0 commit comments