summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sys/signal.rs2
-rw-r--r--test/sys/test_signal.rs14
2 files changed, 15 insertions, 1 deletions
diff --git a/src/sys/signal.rs b/src/sys/signal.rs
index 10798ba1..875f5de6 100644
--- a/src/sys/signal.rs
+++ b/src/sys/signal.rs
@@ -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 {
diff --git a/test/sys/test_signal.rs b/test/sys/test_signal.rs
index ae959ef4..7d3a9bf2 100644
--- a/test/sys/test_signal.rs
+++ b/test/sys/test_signal.rs
@@ -7,6 +7,20 @@ fn test_kill_none() {
}
#[test]
+fn test_old_sigaction_flags() {
+ extern "C" fn handler(_: ::libc::c_int) {}
+ let act = SigAction::new(
+ SigHandler::Handler(handler),
+ SaFlags::empty(),
+ SigSet::empty(),
+ );
+ let oact = unsafe { sigaction(SIGINT, &act) }.unwrap();
+ let _flags = oact.flags();
+ let oact = unsafe { sigaction(SIGINT, &act) }.unwrap();
+ let _flags = oact.flags();
+}
+
+#[test]
fn test_sigprocmask_noop() {
sigprocmask(SigmaskHow::SIG_BLOCK, None, None)
.expect("this should be an effective noop");