Skip to content
Snippets Groups Projects
Verified Commit d13fb3f4 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Fix panic in sigaction

parent bee72373
No related branches found
No related tags found
No related merge requests found
...@@ -74,15 +74,14 @@ pub unsafe extern "C" fn sigaction( ...@@ -74,15 +74,14 @@ pub unsafe extern "C" fn sigaction(
act: *const sigaction, act: *const sigaction,
oact: *mut sigaction, oact: *mut sigaction,
) -> c_int { ) -> c_int {
let mut _sigaction = None; let act_opt = if !act.is_null() {
let ptr = if !act.is_null() { let mut act_clone = (*act).clone();
_sigaction = Some((*act).clone()); act_clone.sa_flags |= SA_RESTORER as c_ulong;
_sigaction.as_mut().unwrap().sa_flags |= SA_RESTORER as c_ulong; Some(act_clone)
_sigaction.as_mut().unwrap() as *mut _
} else { } else {
ptr::null_mut() None
}; };
Sys::sigaction(sig, ptr, oact) Sys::sigaction(sig, act_opt.map_or(ptr::null_mut(), |x| &x), oact)
} }
#[no_mangle] #[no_mangle]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment