message: Fix redox's implementation
diff: @@ -105,27 +105,21 @@ impl PalSignal for Sys {
  0
  }
  - unsafe fn sigaction(sig: c_int, act: *const sigaction, oact: *mut sigaction) -> c_int {
  - let new_opt = if act.is_null() {
  - None
  - } else {
  - let m = (*act).sa_mask;
  - let sa_handler = mem::transmute((*act).sa_handler);
  + fn sigaction(sig: c_int, act: Option<&sigaction>, oact: Option<&mut sigaction>) -> c_int {
  + let new_opt = act.map(|act| {
  + let m = act.sa_mask;
  + let sa_handler = unsafe { mem::transmute(act.sa_handler) };
  println!("signal called with {:x}", unsafe {
  mem::transmute::<_, usize>(sa_handler)
  });
  - Some(syscall::SigAction {
  + syscall::SigAction {
  sa_handler,
  sa_mask: [m as u64, 0],
  - sa_flags: syscall::SigActionFlags::from_bits((*act).sa_flags as usize)
  + sa_flags: syscall::SigActionFlags::from_bits(act.sa_flags as usize)
  .expect("sigaction: invalid bit pattern"),
  - })
  - };
  - let mut old_opt = if oact.is_null() {
  - None
  - } else {
  - Some(syscall::SigAction::default())
  - };
  + }
  + });
  + let mut old_opt = oact.as_ref().map(|_| syscall::SigAction::default());
  println!("before : {:?}", new_opt);
  println!("before old : {:?}", old_opt);
  let ret = e(syscall::sigaction(
  @@ -134,13 +128,13 @@ impl PalSignal for Sys {
  old_opt.as_mut(),
  )) as c_int;
  println!("after : {:?}", old_opt);
  - if let Some(old) = old_opt {
  - (*oact).sa_handler = mem::transmute(old.sa_handler);
  + if let (Some(old), Some(oact)) = (old_opt, oact) {
  + println!("after : {:?}", oact);
  + oact.sa_handler = unsafe { mem::transmute(old.sa_handler) };
  let m = old.sa_mask;
  - (*oact).sa_mask = m[0] as c_ulong;
  - (*oact).sa_flags = old.sa_flags.bits() as c_ulong;
  + oact.sa_mask = m[0] as c_ulong;
  + oact.sa_flags = old.sa_flags.bits() as c_ulong;
  }
  - println!("after : {:?}", (*oact));
  ret
  }
  