File tree Expand file tree Collapse file tree 1 file changed +1
-22
lines changed Expand file tree Collapse file tree 1 file changed +1
-22
lines changed Original file line number Diff line number Diff line change @@ -287,28 +287,7 @@ pub fn temp_dir() -> PathBuf {
287287}
288288
289289pub 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
312291}
313292
314293pub fn exit ( code : i32 ) -> ! {
You can’t perform that action at this time.
0 commit comments