Skip to content

Commit 5206f3a

Browse files
sam-githubMylesBorins
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 94d02ca commit 5206f3a

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
@@ -110,7 +110,9 @@ static int StartDebugSignalHandler() {
110110
sigset_t sigmask;
111111
// Mask all signals.
112112
sigfillset(&sigmask);
113-
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &sigmask));
113+
sigset_t savemask;
114+
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &savemask));
115+
sigmask = savemask;
114116
pthread_t thread;
115117
const int err = pthread_create(&thread, &attr,
116118
StartIoThreadMain, nullptr);

src/node_watchdog.cc

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

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

0 commit comments

Comments
 (0)