Skip to content

Commit

Permalink
Refined write
Browse files Browse the repository at this point in the history
  • Loading branch information
xd009642 committed Oct 7, 2018
1 parent c39f9b2 commit bfde1f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/sys/ptrace/bsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ pub fn read(pid: Pid, addr: AddressType) -> Result<c_int> {
}
}

pub fn write(pid: Pid, addr: AddressType, data: c_int) {
pub fn write(pid: Pid, addr: AddressType, data: c_int) ->Result<()> {
unsafe {
ptrace_other(Request::PT_WRITE_D, pid, addr, data)
ptrace_other(Request::PT_WRITE_D, pid, addr, data).map(|_| ())
}
}
4 changes: 2 additions & 2 deletions src/sys/ptrace/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ pub fn read(pid: Pid, addr: *mut c_void) -> Result<c_long> {
ptrace_peek(Request::PTRACE_PEEKDATA, pid, addr, ptr::null_mut())
}

pub fn write(pid: Pid, addr: *mut c_void, data: *mut c_void) -> Result<c_long> {
pub fn write(pid: Pid, addr: *mut c_void, data: *mut c_void) -> Result<()> {
unsafe {
ptrace_other(Request::PTRACE_POKEDATA, pid, addr, data)
ptrace_other(Request::PTRACE_POKEDATA, pid, addr, data).map(|_| ())
}
}

0 comments on commit bfde1f5

Please sign in to comment.