Skip to content

Commit 6254d7a

Browse files
authored
Rollup merge of rust-lang#64640 - Wind-River:master, r=alexcrichton
No home directory on vxWorks r? @alexcrichton
2 parents 176e216 + 494d83c commit 6254d7a

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

src/libstd/sys/vxworks/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
529529
let p = cstr(p)?;
530530
let mut stat: stat64 = unsafe { mem::zeroed() };
531531
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 _)
533533
})?;
534534
Ok(FileAttr { stat })
535535
}

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)