Skip to content

Commit 16a1f96

Browse files
sam-githubBethGriggs
authored andcommitted
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: #24810 Reviewed-By: Richard Lau <[email protected]>
1 parent f0e7b2f commit 16a1f96

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/inspector_agent.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ static int StartDebugSignalHandler() {
109109
sigset_t sigmask;
110110
// Mask all signals.
111111
sigfillset(&sigmask);
112-
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &sigmask));
112+
sigset_t savemask;
113+
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &savemask));
114+
sigmask = savemask;
113115
pthread_t thread;
114116
const int err = pthread_create(&thread, &attr,
115117
StartIoThreadMain, nullptr);

src/node_watchdog.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ int SigintWatchdogHelper::Start() {
186186

187187
sigset_t sigmask;
188188
sigfillset(&sigmask);
189-
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &sigmask));
189+
sigset_t savemask;
190+
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &savemask));
191+
sigmask = savemask;
190192
int ret = pthread_create(&thread_, nullptr, RunSigintWatchdog, nullptr);
191193
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr));
192194
if (ret != 0) {

0 commit comments

Comments
 (0)