From 5c29eda7ad675246b0bda9076763149960a546f7 Mon Sep 17 00:00:00 2001 From: w Date: Sat, 14 Sep 2019 08:11:18 +0200 Subject: [PATCH] src: add missing sigemptyset() to init sigset_t --- src/node.cc | 6 +++++- src/node_main.cc | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/node.cc b/src/node.cc index 4840b18feed691..8f91ebe8a2d004 100644 --- a/src/node.cc +++ b/src/node.cc @@ -163,6 +163,7 @@ struct V8Platform v8_platform; } // namespace per_process #ifdef __POSIX__ + void SignalExit(int signo, siginfo_t* info, void* ucontext) { ResetStdio(); raise(signo); @@ -548,6 +549,7 @@ void TrapWebAssemblyOrContinue(int signo, siginfo_t* info, void* ucontext) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = SIG_DFL; + sigemptyset(&sa.sa_mask); CHECK_EQ(sigaction(signo, &sa, nullptr), 0); ResetStdio(); @@ -574,8 +576,8 @@ void RegisterSignalHandler(int signal, struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = handler; - sa.sa_flags = reset_handler ? SA_RESETHAND : 0; sigfillset(&sa.sa_mask); + sa.sa_flags = reset_handler ? SA_RESETHAND : 0; CHECK_EQ(sigaction(signal, &sa, nullptr), 0); } #endif // __POSIX__ @@ -623,6 +625,7 @@ inline void PlatformInit() { // Restore signal dispositions, the parent process may have changed them. struct sigaction act; memset(&act, 0, sizeof(act)); + sigemptyset(&act.sa_mask); // The hard-coded upper limit is because NSIG is not very reliable; on Linux, // it evaluates to 32, 34 or 64, depending on whether RT signals are enabled. @@ -675,6 +678,7 @@ inline void PlatformInit() { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = TrapWebAssemblyOrContinue; + sigemptyset(&sa.sa_mask); sa.sa_flags = SA_SIGINFO; CHECK_EQ(sigaction(SIGSEGV, &sa, nullptr), 0); } diff --git a/src/node_main.cc b/src/node_main.cc index 6bac1075932587..2b2de1b48455a7 100644 --- a/src/node_main.cc +++ b/src/node_main.cc @@ -113,6 +113,7 @@ int main(int argc, char* argv[]) { struct sigaction act; memset(&act, 0, sizeof(act)); act.sa_handler = SIG_IGN; + sigemptyset(&act.sa_mask); sigaction(SIGPIPE, &act, nullptr); } #endif