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

Clean up error handling #1524

Merged
merged 8 commits into from
May 9, 2023
Merged

Clean up error handling #1524

merged 8 commits into from
May 9, 2023

Conversation

bi4k8
Copy link
Collaborator

@bi4k8 bi4k8 commented May 5, 2023

Checklist

  • I have described the changes
  • I have linked to any relevant GitHub issues, if applicable
  • [n/a] Documentation in doc/ has been updated
  • All new code is licensed under GPLv3

Description

  • Describe the changes, why they were necessary, etc

This fixes error handling in i8k (#945) and freebsd get_freq. Both would abort in cases they didn't need to, and the freebsd code can actually be made infallible. This also refactors a few cleanup and logging functions to simplify code around the program.

  • Describe how the changes will affect existing behaviour.

Conky will no longer segfault or exit when i8k variables fail to open /proc/i8k. Behavior is otherwise unchanged.

  • Describe how you tested and validated your changes.

Tested with the conkyrc from #945.

  • Include any relevant screenshots/evidence demonstrating that the changes work and have been tested.

bi4k8 added 8 commits May 5, 2023 00:42
there's no need to call calloc() for 16B, nor do we need to error-handle that allocation with exit()
this behavior was already present for the status variables but not others
this also fixes the segfault that would happen in the main loop after `clean_up_without_threads` (brndnmtthws#945)
this lets us simplify error handling
it's surprising to pass 2 nullptr arguments at most of the callsites of a logging function, so instead let callers explicitly state whether they have auxiliary data to free
@netlify
Copy link

netlify bot commented May 5, 2023

Deploy Preview for conkyweb canceled.

Name Link
🔨 Latest commit 757eabc
🔍 Latest deploy log https://app.netlify.com/sites/conkyweb/deploys/64545cb1977175000904728d

@bi4k8 bi4k8 linked an issue May 5, 2023 that may be closed by this pull request
@github-actions github-actions bot added the sources PR modifies project sources label May 5, 2023
@bi4k8 bi4k8 merged commit 00166b4 into brndnmtthws:main May 9, 2023
@bi4k8 bi4k8 deleted the error-handling branch May 9, 2023 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sources PR modifies project sources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash if i8k kernel module is not loaded
2 participants