diff options
author | Jamie Hewland <jhewland@gmail.com> | 2017-11-12 12:10:41 +0200 |
---|---|---|
committer | Jamie Hewland <jhewland@gmail.com> | 2017-11-12 12:10:41 +0200 |
commit | 0c786dfe62dc43b7a463d00fd9c37475ee5a1ce3 (patch) | |
tree | 61c390a7864e34399ae961aa29ee35057e01a1d6 | |
parent | d4e7761923b71aac253675814ae6da723d74b59c (diff) | |
download | nix-0c786dfe62dc43b7a463d00fd9c37475ee5a1ce3.zip |
unistd: Rework import of std::ptr
-rw-r--r-- | src/unistd.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/unistd.rs b/src/unistd.rs index 2b2f3751..dc0d5d07 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -6,7 +6,7 @@ use fcntl::{fcntl, OFlag, O_CLOEXEC, FD_CLOEXEC}; use fcntl::FcntlArg::F_SETFD; use libc::{self, c_char, c_void, c_int, c_long, c_uint, size_t, pid_t, off_t, uid_t, gid_t, mode_t}; -use std::{self, fmt, mem}; +use std::{fmt, mem, ptr}; use std::ffi::{CString, CStr, OsString, OsStr}; use std::os::unix::ffi::{OsStringExt, OsStrExt}; use std::os::unix::io::RawFd; @@ -553,9 +553,6 @@ pub fn chown<P: ?Sized + NixPath>(path: &P, owner: Option<Uid>, group: Option<Gi } fn to_exec_array(args: &[CString]) -> Vec<*const c_char> { - use std::ptr; - use libc::c_char; - let mut args_p: Vec<*const c_char> = args.iter().map(|s| s.as_ptr()).collect(); args_p.push(ptr::null()); args_p @@ -1056,7 +1053,7 @@ pub fn setgid(gid: Gid) -> Result<()> { #[cfg(not(any(target_os = "ios", target_os = "macos")))] pub fn getgroups() -> Result<Vec<Gid>> { // First get the number of groups so we can size our Vec - let ret = unsafe { libc::getgroups(0, std::ptr::null_mut()) }; + let ret = unsafe { libc::getgroups(0, ptr::null_mut()) }; // Now actually get the groups. We try multiple times in case the number of // groups has changed since the first call to getgroups() and the buffer is |