File tree 1 file changed +9
-12
lines changed
1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -584,18 +584,15 @@ pub fn home_dir() -> Option<PathBuf> {
584
584
n if n < 0 => 512 as usize ,
585
585
n => n as usize ,
586
586
} ;
587
- let me = libc:: getuid ( ) ;
588
- loop {
589
- let mut buf = Vec :: with_capacity ( amt) ;
590
- let mut passwd: libc:: passwd = mem:: zeroed ( ) ;
591
-
592
- if getpwduid_r ( me, & mut passwd, & mut buf) . is_some ( ) {
593
- let ptr = passwd. pw_dir as * const _ ;
594
- let bytes = CStr :: from_ptr ( ptr) . to_bytes ( ) . to_vec ( ) ;
595
- return Some ( OsStringExt :: from_vec ( bytes) )
596
- } else {
597
- return None ;
598
- }
587
+ let mut buf = Vec :: with_capacity ( amt) ;
588
+ let mut passwd: libc:: passwd = mem:: zeroed ( ) ;
589
+
590
+ if getpwduid_r ( libc:: getuid ( ) , & mut passwd, & mut buf) . is_some ( ) {
591
+ let ptr = passwd. pw_dir as * const _ ;
592
+ let bytes = CStr :: from_ptr ( ptr) . to_bytes ( ) . to_vec ( ) ;
593
+ Some ( OsStringExt :: from_vec ( bytes) )
594
+ } else {
595
+ None
599
596
}
600
597
}
601
598
}
You can’t perform that action at this time.
0 commit comments