-
Notifications
You must be signed in to change notification settings - Fork 596
Code quality #9666
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
Code quality #9666
Conversation
julianbrost
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I haven't looked into the other changes in detail, just the one where I know there is a problem.)
| for (int i = 0; i < envc; i++) { | ||
| if (strncmp(environ[i], lcnumeric, strlen(lcnumeric)) == 0) { | ||
| if (strcmp(environ[i], lcnumeric) == 0) { | ||
| continue; | ||
| } | ||
|
|
||
| if (strncmp(environ[i], notifySocket, strlen(notifySocket)) == 0) { | ||
| if (strcmp(environ[i], notifySocket) == 0) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's actually not just a redundant overflow protection but is actually implementing a prefix check here. But that's totally not obvious here, I also got this wrong first. So changing the code to make this more obvious would actually be a quality improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, just remove f5380cf.
| for (int i = 0; i < envc; i++) { | ||
| if (strncmp(environ[i], lcnumeric, strlen(lcnumeric)) == 0) { | ||
| if (strcmp(environ[i], lcnumeric) == 0) { | ||
| continue; | ||
| } | ||
|
|
||
| if (strncmp(environ[i], notifySocket, strlen(notifySocket)) == 0) { | ||
| if (strcmp(environ[i], notifySocket) == 0) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, just remove f5380cf.
|
All the changes from this PR can be found in #9502, so there's no need for this. |
No description provided.