Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing sigemptyset() to init sigset_t #29554

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -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;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please clarify why it's moved below sigfillset?

CHECK_EQ(sigaction(signal, &sa, nullptr), 0);
}
#endif // __POSIX__
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/node_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down