From 8695ecd82bc2dcb67e0bada0e73b3463950abb22 Mon Sep 17 00:00:00 2001 From: jD91mZM2 <me@krake.one> Date: Sat, 20 Jul 2019 22:13:54 +0200 Subject: [PATCH] Fix sigaction Undefind Behavior Rust does not allow a `fn`-pointer to be null. This fixes that, while luckily doing it in a way that leaves system calls backwards-compatible :) --- src/context/signal.rs | 2 +- syscall | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/context/signal.rs b/src/context/signal.rs index fc8e4626..a19376af 100644 --- a/src/context/signal.rs +++ b/src/context/signal.rs @@ -15,7 +15,7 @@ pub extern "C" fn signal_handler(sig: usize) { actions[sig] }; - let handler = action.sa_handler as usize; + let handler = action.sa_handler.map(|ptr| ptr as usize).unwrap_or(0); if handler == SIG_DFL { match sig { SIGCHLD => { diff --git a/syscall b/syscall index eddcb80e..f3bb1f7b 160000 --- a/syscall +++ b/syscall @@ -1 +1 @@ -Subproject commit eddcb80eb7c2d43dedf0ba2ee514b54b0b8fafc7 +Subproject commit f3bb1f7b68bc8e5544857781de9eb8729b2843f4 -- GitLab