From 5206f3add5e9a2077f8e8cd718e280934e1c33ad Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Mon, 3 Dec 2018 09:09:59 -0800 Subject: [PATCH] src: do not alias new and old signal masks In recent gcc, -Wrestrict warns when an argument passed to a restrict-qualified parameter aliases with another argument. PR-URL: https://github.com/nodejs/node/pull/24810 Reviewed-By: Richard Lau --- src/inspector_agent.cc | 4 +++- src/node_watchdog.cc | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 5e53201c42d5c2..21319abca7d1f5 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -110,7 +110,9 @@ static int StartDebugSignalHandler() { sigset_t sigmask; // Mask all signals. sigfillset(&sigmask); - CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &sigmask)); + sigset_t savemask; + CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &savemask)); + sigmask = savemask; pthread_t thread; const int err = pthread_create(&thread, &attr, StartIoThreadMain, nullptr); diff --git a/src/node_watchdog.cc b/src/node_watchdog.cc index b8665dc1be225d..9ef7bafeded44f 100644 --- a/src/node_watchdog.cc +++ b/src/node_watchdog.cc @@ -187,7 +187,9 @@ int SigintWatchdogHelper::Start() { sigset_t sigmask; sigfillset(&sigmask); - CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &sigmask)); + sigset_t savemask; + CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &savemask)); + sigmask = savemask; int ret = pthread_create(&thread_, nullptr, RunSigintWatchdog, nullptr); CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr)); if (ret != 0) {