redfishpower: fix const-correctness in calc_path() - #217
Merged
Merged
Conversation
Member
|
i'll set MWP for you |
Member
|
@Mergifyio rebase |
chu11
force-pushed
the
fix-const-ness-redfishpower
branch
from
June 1, 2026 17:47
5e953e6 to
a3b68e4
Compare
Contributor
|
Deprecation notice: This pull request comes from a fork and was rebased using |
Contributor
✅ Branch has been successfully rebased |
Member
|
@Mergifyio rebase |
Contributor
Merge Queue Status
This pull request spent 26 seconds in the queue, with no time running CI. Required conditions to merge
|
calc_path() receives lpath as const char * and only reads from the substring located with strstr(). On modern libc/toolchains, strstr() is const-preserving for const inputs. Assigning its result to char * therefore discards qualifiers and may fail with -Werror=discarded-qualifiers.
mergify
Bot
force-pushed
the
fix-const-ness-redfishpower
branch
from
June 8, 2026 20:30
a3b68e4 to
457f95a
Compare
Contributor
☑️ Nothing to do, the required conditions are not metDetails
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
calc_path() receives lpath as const char * and only reads from the substring located with strstr().
On modern libc/toolchains, strstr() is const-preserving for const inputs. Assigning its result to char * therefore discards qualifiers and may fail with -Werror=discarded-qualifiers.
On latest Ubuntu release, powerman fails to build with following error:
redfishpower.c: In function ‘calc_path’:
redfishpower.c:199:14: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
199 | if ((ptr = strstr(lpath, "{{plug}}"))) {