Skip to content

Commit 5c29eda

Browse files
mcpiromanaduh95
authored andcommitted
src: add missing sigemptyset() to init sigset_t
1 parent 0185464 commit 5c29eda

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/node.cc

+5-1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ struct V8Platform v8_platform;
163163
} // namespace per_process
164164

165165
#ifdef __POSIX__
166+
166167
void SignalExit(int signo, siginfo_t* info, void* ucontext) {
167168
ResetStdio();
168169
raise(signo);
@@ -548,6 +549,7 @@ void TrapWebAssemblyOrContinue(int signo, siginfo_t* info, void* ucontext) {
548549
struct sigaction sa;
549550
memset(&sa, 0, sizeof(sa));
550551
sa.sa_handler = SIG_DFL;
552+
sigemptyset(&sa.sa_mask);
551553
CHECK_EQ(sigaction(signo, &sa, nullptr), 0);
552554

553555
ResetStdio();
@@ -574,8 +576,8 @@ void RegisterSignalHandler(int signal,
574576
struct sigaction sa;
575577
memset(&sa, 0, sizeof(sa));
576578
sa.sa_sigaction = handler;
577-
sa.sa_flags = reset_handler ? SA_RESETHAND : 0;
578579
sigfillset(&sa.sa_mask);
580+
sa.sa_flags = reset_handler ? SA_RESETHAND : 0;
579581
CHECK_EQ(sigaction(signal, &sa, nullptr), 0);
580582
}
581583
#endif // __POSIX__
@@ -623,6 +625,7 @@ inline void PlatformInit() {
623625
// Restore signal dispositions, the parent process may have changed them.
624626
struct sigaction act;
625627
memset(&act, 0, sizeof(act));
628+
sigemptyset(&act.sa_mask);
626629

627630
// The hard-coded upper limit is because NSIG is not very reliable; on Linux,
628631
// it evaluates to 32, 34 or 64, depending on whether RT signals are enabled.
@@ -675,6 +678,7 @@ inline void PlatformInit() {
675678
struct sigaction sa;
676679
memset(&sa, 0, sizeof(sa));
677680
sa.sa_sigaction = TrapWebAssemblyOrContinue;
681+
sigemptyset(&sa.sa_mask);
678682
sa.sa_flags = SA_SIGINFO;
679683
CHECK_EQ(sigaction(SIGSEGV, &sa, nullptr), 0);
680684
}

src/node_main.cc

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ int main(int argc, char* argv[]) {
113113
struct sigaction act;
114114
memset(&act, 0, sizeof(act));
115115
act.sa_handler = SIG_IGN;
116+
sigemptyset(&act.sa_mask);
116117
sigaction(SIGPIPE, &act, nullptr);
117118
}
118119
#endif

0 commit comments

Comments
 (0)