diff options
author | Stewart X Addison <sxa@uk.ibm.com> | 2016-12-30 12:44:46 +0000 |
---|---|---|
committer | Gibson Fahnestock <gib@uk.ibm.com> | 2017-01-17 14:10:13 +0000 |
commit | 0f0f3d33309d3382deb33825fdffeb048f80ec18 (patch) | |
tree | 15e0be4d314eb886bd7cfc3ba8de33d0ed1ae990 /src | |
parent | e050c349ee771ef18298a0d1599e9bc460ddf532 (diff) | |
download | android-node-v8-0f0f3d33309d3382deb33825fdffeb048f80ec18.tar.gz android-node-v8-0f0f3d33309d3382deb33825fdffeb048f80ec18.tar.bz2 android-node-v8-0f0f3d33309d3382deb33825fdffeb048f80ec18.zip |
build: don't squash signal handlers with --shared
An application using node built as a shared library may legitimately
implement its own signal handling routines. Current behaviour is
to squash all signal handlers on node startup. This change will
stop that behaviour when node is built as a shared library.
PR-URL: https://github.com/nodejs/node/pull/10539
Fixes: https://github.com/nodejs/node/issues/10520
Refs: https://github.com/nodejs/node/pull/615
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src')
-rw-r--r-- | src/node.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/node.cc b/src/node.cc index 5c11cfd096..16250a8514 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2192,7 +2192,7 @@ static void WaitForInspectorDisconnect(Environment* env) { if (env->inspector_agent()->IsConnected()) { // Restore signal dispositions, the app is done and is no longer // capable of handling signals. -#ifdef __POSIX__ +#if defined(__POSIX__) && !defined(NODE_SHARED_MODE) struct sigaction act; memset(&act, 0, sizeof(act)); for (unsigned nr = 1; nr < kMaxSignal; nr += 1) { @@ -4099,6 +4099,7 @@ inline void PlatformInit() { CHECK_EQ(err, 0); +#ifndef NODE_SHARED_MODE // Restore signal dispositions, the parent process may have changed them. struct sigaction act; memset(&act, 0, sizeof(act)); @@ -4112,6 +4113,7 @@ inline void PlatformInit() { act.sa_handler = (nr == SIGPIPE) ? SIG_IGN : SIG_DFL; CHECK_EQ(0, sigaction(nr, &act, nullptr)); } +#endif // !NODE_SHARED_MODE RegisterSignalHandler(SIGINT, SignalExit, true); RegisterSignalHandler(SIGTERM, SignalExit, true); |