Skip to content

Commit

Permalink
Merge pull request #3 from trailofbits/ww/qa
Browse files Browse the repository at this point in the history
lib: Simplify error handling slightly
  • Loading branch information
luser committed Oct 16, 2020
2 parents e136193 + 7a29f91 commit f6a8056
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,10 @@ impl CommandPtraceSpawn for Command {
let child = unsafe {
self.pre_exec(|| {
// Opt-in to ptrace.
match ptrace::traceme() {
Ok(()) => Ok(()),
Err(e) => match e {
nix::Error::Sys(e) => Err(io::Error::from_raw_os_error(e as i32)),
_ => Err(io::Error::new(
io::ErrorKind::Other,
"unknown PTRACE_TRACEME error",
)),
},
}
ptrace::traceme().map_err(|e| match e {
nix::Error::Sys(e) => io::Error::from_raw_os_error(e as i32),
_ => io::Error::new(io::ErrorKind::Other, "unknown PTRACE_TRACEME error"),
})
})
.spawn()?
};
Expand Down

0 comments on commit f6a8056

Please sign in to comment.