about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorNikita Baksalyar <nikita.baksalyar@gmail.com>2016-02-03 16:45:34 +0300
committerNikita Baksalyar <nikita.baksalyar@gmail.com>2016-02-03 16:45:34 +0300
commitfae883c113031805cedb853c4176ecfef0b62bbc (patch)
tree7933463685481ed24cfae8c3d4f05b6ea6a5048d /src/libstd/sys
parentbb6e646c7b7c8c97982106aafc106b18a1913c81 (diff)
downloadrust-fae883c113031805cedb853c4176ecfef0b62bbc.tar.gz
rust-fae883c113031805cedb853c4176ecfef0b62bbc.zip
Fix broken auto-mac-ios-opt build
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/unix/fs.rs6
-rw-r--r--src/libstd/sys/unix/os.rs44
2 files changed, 23 insertions, 27 deletions
diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs
index bbc4be9c68a..5ee44bbfece 100644
--- a/src/libstd/sys/unix/fs.rs
+++ b/src/libstd/sys/unix/fs.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use prelude::v1::*;
 use io::prelude::*;
 use os::unix::prelude::*;
 
@@ -23,11 +24,6 @@ use sys::fd::FileDesc;
 use sys::platform::raw;
 use sys::{cvt, cvt_r};
 use sys_common::{AsInner, FromInner};
-use vec::Vec;
-#[cfg(target_os = "solaris")]
-use core_collections::borrow::ToOwned;
-#[cfg(target_os = "solaris")]
-use boxed::Box;
 
 pub struct File(FileDesc);
 
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs
index fc1fea4bc71..da770514593 100644
--- a/src/libstd/sys/unix/os.rs
+++ b/src/libstd/sys/unix/os.rs
@@ -507,28 +507,6 @@ pub fn home_dir() -> Option<PathBuf> {
         fallback()
     }).map(PathBuf::from);
 
-    #[cfg(not(target_os = "solaris"))]
-    unsafe fn getpwduid_r(me: libc::uid_t, passwd: &mut libc::passwd,
-                          buf: &mut Vec<c_char>) -> Option<()> {
-        let mut result = ptr::null_mut();
-        match libc::getpwuid_r(me, passwd, buf.as_mut_ptr(),
-                               buf.capacity() as libc::size_t,
-                               &mut result) {
-            0 if !result.is_null() => Some(()),
-            _ => None
-        }
-    }
-
-    #[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() as libc::size_t);
-        if result.is_null() { None } else { Some(()) }
-    }
-
     #[cfg(any(target_os = "android",
               target_os = "ios",
               target_os = "nacl"))]
@@ -537,6 +515,28 @@ pub fn home_dir() -> Option<PathBuf> {
                   target_os = "ios",
                   target_os = "nacl")))]
     unsafe fn fallback() -> Option<OsString> {
+        #[cfg(not(target_os = "solaris"))]
+        unsafe fn getpwduid_r(me: libc::uid_t, passwd: &mut libc::passwd,
+                              buf: &mut Vec<c_char>) -> Option<()> {
+            let mut result = ptr::null_mut();
+            match libc::getpwuid_r(me, passwd, buf.as_mut_ptr(),
+                                   buf.capacity() as libc::size_t,
+                                   &mut result) {
+                0 if !result.is_null() => Some(()),
+                _ => None
+            }
+        }
+
+        #[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() as libc::size_t);
+            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,