auto merge of #13613 : alexcrichton/rust/fix-freebsd-compile, r=brson
Ah, the wonders of not being gated on FreeBSD...
This commit is contained in:
commit
7b6e7ebe73
1 changed files with 2 additions and 3 deletions
|
|
@ -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];
|
||||
|
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue