GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: don't reset embeder signal handlers · nodejs/node@7a80312

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,17 @@ void ResetSignalHandlers() {
447447
if (nr == SIGKILL || nr == SIGSTOP)
448448
continue;
449449
act.sa_handler = (nr == SIGPIPE || nr == SIGXFSZ) ? SIG_IGN : SIG_DFL;
450+
if (act.sa_handler == SIG_DFL) {
451+
// The only bad handler value we can inhert from before exec is SIG_IGN
452+
// (any actual function pointer is reset to SIG_DFL during exec).
453+
// If that's the case, we want to reset it back to SIG_DFL.
454+
// However, it's also possible that an embeder (or an LD_PRELOAD-ed
455+
// library) has set up own signal handler for own purposes
456+
// (e.g. profiling). If that's the case, we want to keep it intact.
457+
struct sigaction old;
458+
CHECK_EQ(0, sigaction(nr, nullptr, &old));
459+
if ((old.sa_flags & SA_SIGINFO) || old.sa_handler != SIG_IGN) continue;
460+
}
450461
CHECK_EQ(0, sigaction(nr, &act, nullptr));
451462
}
452463
#endif // __POSIX__

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.