Skip to content

Commit

Permalink
Change SigAction::flags to use from_bits_truncated
Browse files Browse the repository at this point in the history
On Linux, if the signal trampoline code is in the C library, sigaction
sets the SA_RESTORER flag (0x04000000) in the sa_flags field of old
sigaction (see sigreturn(2)).

This is not intended for application use and is missing from SaFlags,
therefore from_bits fails and unwrapping panics the user program.

This fix just drops the bits that are not defined in SaFlags.
  • Loading branch information
Detegr committed Mar 2, 2018
1 parent 2b9c67c commit 8c7ba83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sys/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ impl SigAction {
}

pub fn flags(&self) -> SaFlags {
SaFlags::from_bits(self.sigaction.sa_flags).unwrap()
SaFlags::from_bits_truncate(self.sigaction.sa_flags)
}

pub fn mask(&self) -> SigSet {
Expand Down

0 comments on commit 8c7ba83

Please sign in to comment.