diff options
author | Tobias Bucher <tobiasbucher5991@gmail.com> | 2015-04-14 13:41:14 +0200 |
---|---|---|
committer | Tobias Bucher <tobiasbucher5991@gmail.com> | 2015-04-14 16:34:51 +0200 |
commit | a9ce14cd5ace5da9c2b15c7eb6de5c51375621e2 (patch) | |
tree | 903eecce22d09126900c463c003ed0d5c75a621a /src/sys/signal.rs | |
parent | e3d86a9ccd59c8332116041e5e32473d7835f43a (diff) | |
download | nix-a9ce14cd5ace5da9c2b15c7eb6de5c51375621e2.zip |
Make `sigaction` unsafe
This is done because interrupted execution has soundness bugs regarding
thread-local storage. Fixes #90.
Diffstat (limited to 'src/sys/signal.rs')
-rw-r--r-- | src/sys/signal.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/sys/signal.rs b/src/sys/signal.rs index 1cc3f393..112a7bcd 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -350,12 +350,11 @@ impl SigAction { } } -pub fn sigaction(signum: SigNum, sigaction: &SigAction) -> Result<SigAction> { - let mut oldact = unsafe { mem::uninitialized::<sigaction_t>() }; +pub unsafe fn sigaction(signum: SigNum, sigaction: &SigAction) -> Result<SigAction> { + let mut oldact = mem::uninitialized::<sigaction_t>(); - let res = unsafe { - ffi::sigaction(signum, &sigaction.sigaction as *const sigaction_t, &mut oldact as *mut sigaction_t) - }; + let res = + ffi::sigaction(signum, &sigaction.sigaction as *const sigaction_t, &mut oldact as *mut sigaction_t); if res < 0 { return Err(Error::Sys(Errno::last())); |