Skip to content

libstd needs update for pending libc change #39871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 19, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions src/libstd/sys/unix/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,6 @@ pub fn home_dir() -> Option<PathBuf> {
target_os = "nacl",
target_os = "emscripten")))]
unsafe fn fallback() -> Option<OsString> {
#[cfg(not(target_os = "solaris"))]
unsafe fn getpwduid_r(me: libc::uid_t, passwd: &mut libc::passwd,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that there's no abstraction, could this wrapper be removed entirely?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you're right. I was attempting to minimise changes here, but the wrapper could be removed entirely. Let me simplify this further and rebuild.

buf: &mut Vec<c_char>) -> Option<()> {
let mut result = ptr::null_mut();
Expand All @@ -495,16 +494,6 @@ pub fn home_dir() -> Option<PathBuf> {
}
}

#[cfg(target_os = "solaris")]
unsafe fn getpwduid_r(me: libc::uid_t, passwd: &mut libc::passwd,
buf: &mut Vec<c_char>) -> Option<()> {
// getpwuid_r semantics is different on Illumos/Solaris:
// http://illumos.org/man/3c/getpwuid_r
let result = libc::getpwuid_r(me, passwd, buf.as_mut_ptr(),
buf.capacity());
if result.is_null() { None } else { Some(()) }
}

let amt = match libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX) {
n if n < 0 => 512 as usize,
n => n as usize,
Expand Down