fix(ppc/udev): memset 'name' -> 'path' so cpufetch builds on ppc64le - #408
Closed
MukundaKatta wants to merge 1 commit into
Closed
fix(ppc/udev): memset 'name' -> 'path' so cpufetch builds on ppc64le#408MukundaKatta wants to merge 1 commit into
MukundaKatta wants to merge 1 commit into
Conversation
fill_array_from_sys declares 'char path[128];' but then called
'memset(name, 0, sizeof(char) * 128);'. 'name' is not declared in that
scope, so clang fails with:
src/ppc/udev.c:16:10: error: use of undeclared identifier 'name'
Change the memset to zero 'path', which matches the buffer actually
used on the next line (sprintf(path, ...)).
Closes Dr-Noob#403
|
cpufetch does not accept pull requests, see the contributing guidelines for details |
Author
|
Withdrawing — low-value drive-by change. Apologies for the noise. |
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.
Summary
`fill_array_from_sys` in `src/ppc/udev.c` declares `char path[128];` but calls `memset(name, 0, sizeof(char) * 128);`. `name` isn't declared in that scope, so the file fails to compile on a strict toolchain (clang on ppc64le / Chimera Linux, per #403):
```
src/ppc/udev.c:16:10: error: use of undeclared identifier 'name'
```
Changed the `memset` target to the actually-declared `path` buffer, which is also what `sprintf(path, ...)` writes to on the next line. Used `sizeof(path)` for symmetry with the declared size.
Closes #403
Testing
Confirmed via grep that `name` is not declared anywhere else in the file. Did not have a ppc64le toolchain locally to run a full build — would be great if a maintainer with ppc access confirms the build now passes.