summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-03-02 21:52:12 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-03-02 21:52:12 +0000
commitad624c85cc091714672a6ddeb064847dc98356a6 (patch)
tree4cd2b8e67c5602910f7f79941c27e0a9c3f5228f /test
parent2b9c67cca5c6113a9b8162ca7abef33269439997 (diff)
parent44192051dcc60a9ebd9803ed085bbdd9d0b53d8e (diff)
downloadnix-ad624c85cc091714672a6ddeb064847dc98356a6.zip
Merge #869
869: Change SigAction::flags to use from_bits_truncated r=asomers a=Detegr 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.
Diffstat (limited to 'test')
-rw-r--r--test/sys/test_signal.rs14
1 files changed, 14 insertions, 0 deletions
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");