From f73ae058197ac134b89b0765bae147a19122f3dd Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Tue, 30 Jan 2024 20:34:05 +0900 Subject: [PATCH] Prefer `sa_handler` to `sa_sigaction` in Wasm Previously the code assigns `handler` function pointer, which accepts one argument, to `sigact.sa_sigaction`, which accepts three argument. This mismatch is not allowed in Wasm. I don't see the reason to use `sa_sigaction` here, so this change assigns to `sa_handler`, which accepts one argument, in Wasm. --- signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signal.c b/signal.c index bef3b2e537..7535479950 100644 --- a/signal.c +++ b/signal.c @@ -597,7 +597,7 @@ ruby_signal(int signum, sighandler_t handler) #endif sigemptyset(&sigact.sa_mask); -#ifdef USE_SIGALTSTACK +#if defined(USE_SIGALTSTACK) && !defined(__wasm__) if (handler == SIG_IGN || handler == SIG_DFL) { sigact.sa_handler = handler; sigact.sa_flags = 0;