Skip to content

std: Fix compiling on FreeBSD #13613

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 1 commit into from
Apr 19, 2014
Merged
Changes from all commits
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
5 changes: 2 additions & 3 deletions src/libstd/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ pub fn self_exe_name() -> Option<Path> {
unsafe {
use libc::funcs::bsd44::*;
use libc::consts::os::extra::*;
use slice;
let mib = ~[CTL_KERN as c_int,
KERN_PROC as c_int,
KERN_PROC_PATHNAME as c_int, -1 as c_int];
Expand All @@ -429,14 +428,14 @@ pub fn self_exe_name() -> Option<Path> {
0u as libc::size_t);
if err != 0 { return None; }
if sz == 0 { return None; }
let mut v: ~[u8] = slice::with_capacity(sz as uint);
let mut v: Vec<u8> = Vec::with_capacity(sz as uint);
let err = sysctl(mib.as_ptr(), mib.len() as ::libc::c_uint,
v.as_mut_ptr() as *mut c_void, &mut sz, ptr::null(),
0u as libc::size_t);
if err != 0 { return None; }
if sz == 0 { return None; }
v.set_len(sz as uint - 1); // chop off trailing NUL
Some(v)
Some(v.move_iter().collect())
}
}

Expand Down