Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings about -Wrestrict and -Wformat-truncation #24810

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/inspector_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/node_watchdog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ std::string GetHumanReadableProcessName() {
}

void GetHumanReadableProcessName(char (*name)[1024]) {
char title[1024] = "Node.js";
// Leave room after title for pid, which can be up to 20 digits for 64 bit.
char title[1000] = "Node.js";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@addaleax see ---^ I'm OK with it not being semver-major, but if there was a process-name longer than 1000 chars, it would now be slightly truncated. How paranoid should we be? I'll let someone else decide.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay, given that names of that length are very unlikely, and we mostly only use this for debugging purposes?

uv_get_process_title(title, sizeof(title));
snprintf(*name, sizeof(*name), "%s[%d]", title, uv_os_getpid());
}
Expand Down