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

src: clean up SafeGetenv() #13220

Merged
merged 1 commit into from
May 29, 2017
Merged

src: clean up SafeGetenv() #13220

merged 1 commit into from
May 29, 2017

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented May 25, 2017

This commit:

  • Reduces duplicated code.
  • Only checks linux_at_secure on Linux (it's false otherwise).
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

src

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label May 25, 2017
src/node.cc Outdated
return false;
}

#if defined(__linux__)
Copy link
Contributor

Choose a reason for hiding this comment

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

I might have misunderstood the code review but it was intentional to not have the macro guard (__linux__) here. Perhaps the variable should also be guarded in node_main.cc and node.cc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, we could skip the #ifdef __linux__ ugliness mentioned there, and just add linux_at_secure into the existing if (getuid() != geteuid() || getgid() != getegid()) check. Whichever you prefer.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd opt for not having the #ifdef if that is acceptable.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, the idea was to have as little code behind ifdefs as possible.

@cjihrig
Copy link
Contributor Author

cjihrig commented May 29, 2017

Removed extra #ifdef. CI: https://ci.nodejs.org/job/node-test-pull-request/8358/

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

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

LGTM

PR-URL: nodejs#13220
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@cjihrig cjihrig merged commit 88fe7e8 into nodejs:master May 29, 2017
@cjihrig cjihrig deleted the safegetenv branch May 29, 2017 15:54
jasnell pushed a commit that referenced this pull request May 29, 2017
PR-URL: #13220
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@gibfahn gibfahn mentioned this pull request Jun 15, 2017
3 tasks
@MylesBorins
Copy link
Contributor

Should this land on v6.x?

@MylesBorins
Copy link
Contributor

ping @cjihrig

@cjihrig
Copy link
Contributor Author

cjihrig commented Aug 15, 2017

It can. It's not critical though.

@MylesBorins
Copy link
Contributor

this is not landing cleanly. Putting "don't land" for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants