Skip to content

Commit

Permalink
init sigaction to 0 with memset
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpiroman committed Jan 12, 2020
1 parent 0ca3743 commit d910b3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ void TrapWebAssemblyOrContinue(int signo, siginfo_t* info, void* ucontext) {
} else {
// Reset to the default signal handler, i.e. cause a hard crash.
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = SIG_DFL;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
Expand All @@ -515,6 +516,7 @@ void RegisterSignalHandler(int signal,
}
#endif // NODE_USE_V8_WASM_TRAP_HANDLER
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_sigaction = handler;
sigfillset(&sa.sa_mask);
sa.sa_flags = reset_handler ? SA_RESETHAND : 0;
Expand Down Expand Up @@ -565,6 +567,7 @@ inline void PlatformInit() {
#ifndef NODE_SHARED_MODE
// Restore signal dispositions, the parent process may have changed them.
struct sigaction act;
memset(&act, 0, sizeof(act));
sigemptyset(&act.sa_mask);
act.sa_flags = 0;

Expand Down Expand Up @@ -617,6 +620,7 @@ inline void PlatformInit() {
// and pass the signal context to V8.
{
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_sigaction = TrapWebAssemblyOrContinue;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
Expand Down
1 change: 1 addition & 0 deletions src/node_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ int main(int argc, char* argv[]) {
// removed.
{
struct sigaction act;
memset(&act, 0, sizeof(act));
act.sa_handler = SIG_IGN;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
Expand Down

0 comments on commit d910b3c

Please sign in to comment.