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 implicit declaration of function strerror #9

Merged
merged 1 commit into from
Dec 25, 2021

Conversation

ryandesign
Copy link
Contributor

I'm working on getting this to compile on Linux. On Ubuntu Server 20.04 with gcc 9.3.0, I noticed this warning:

/home/rschmidt/xserve-frontpanel/cpu_usage.c:22:50: warning: implicit declaration of function ‘strerror’; did you mean ‘perror’? [-Wimplicit-function-declaration]
   22 |         printf("ERROR fetching hw.packages: %s", strerror(errno));
      |                                                  ^~~~~~~~
      |                                                  perror

strerror(3) tells us that it is defined in <string.h> so the fix is to include that header.

(I don't see this warning on macOS 10.13.6 with clang. Presumably there, <string.h> got included automatically by one of the other headers.)

@ryandesign
Copy link
Contributor Author

ryandesign commented Mar 11, 2021

I have several other small unconnected fixes I'd like to submit. Would you prefer a separate pull request for each? Or all together in one PR with separate commits? Or include the small fixes with my work on adding Linux support (which is where they currently are)?

@castvoid
Copy link
Owner

Hey @ryandesign! Thanks for submitting this fix :)

Sorry for the delay in reviewing. This looks good to me, so I'll merge your PRs now.

@castvoid castvoid merged commit 558900a into castvoid:master Dec 25, 2021
@ryandesign ryandesign deleted the implicit branch December 25, 2021 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants