summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sys/ptrace.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/sys/ptrace.rs b/src/sys/ptrace.rs
index 4c3d29b1..73ca9160 100644
--- a/src/sys/ptrace.rs
+++ b/src/sys/ptrace.rs
@@ -97,13 +97,10 @@ fn ptrace_peek(request: ptrace::PtraceRequest, pid: Pid, addr: *mut c_void, data
/// requests.
fn ptrace_get_data<T>(request: ptrace::PtraceRequest, pid: Pid) -> Result<T> {
// Creates an uninitialized pointer to store result in
- let data: Box<T> = Box::new(unsafe { mem::uninitialized() });
- let data: *mut c_void = unsafe { mem::transmute(data) };
- let res = unsafe { ffi::ptrace(request, pid.into(), ptr::null_mut(), data) };
+ let data: T = unsafe { mem::uninitialized() };
+ let res = unsafe { ffi::ptrace(request, pid.into(), ptr::null_mut(), &data as *const _ as *const c_void) };
Errno::result(res)?;
- // Convert back into the original data format and return unboxed value
- let data: Box<T> = unsafe { mem::transmute(data) };
- Ok(*data)
+ Ok(data)
}
fn ptrace_other(request: ptrace::PtraceRequest, pid: Pid, addr: *mut c_void, data: *mut c_void) -> Result<c_long> {