Skip to content

Commit fbf9fa4

Browse files
authored
Merge pull request #24 from Wind-River/home_directory
No home directory on vxWorks
2 parents 66b1649 + 491a0c6 commit fbf9fa4

File tree

1 file changed

+1
-22
lines changed
  • src/libstd/sys/vxworks

1 file changed

+1
-22
lines changed

src/libstd/sys/vxworks/os.rs

+1-22
Original file line numberDiff line numberDiff line change
@@ -287,28 +287,7 @@ pub fn temp_dir() -> PathBuf {
287287
}
288288

289289
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
312291
}
313292

314293
pub fn exit(code: i32) -> ! {

0 commit comments

Comments
 (0)