Skip to content

[examples-EventsHandler] Clang - Fix WEXITSTATUS usage by passing a variable #253

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

Merged
merged 1 commit into from
Jun 12, 2025

Conversation

thomas-brunel
Copy link
Contributor

Passing the result of the system command directly to WEXITSTATUS treats it as a temporary value, which may lead to invalid memory access. By storing the result in a variable before calling the macro, we ensure that the variable's address is valid, preventing errors or warnings. Clang especially reports it as an error, preventing compilation.

Partially solves issue #250

…ariable

Passing the result of the system command directly to WEXITSTATUS treats
it as a temporary value, which may lead to invalid memory access. By
storing the result in a variable before calling the macro, we ensure
that the variable's address is valid, preventing errors or warnings.

Signed-off-by: Thomas BRUNEL <[email protected]>
Copy link
Owner

@c-jimenez c-jimenez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix

@c-jimenez c-jimenez added the bug Something isn't working label Jun 12, 2025
@c-jimenez c-jimenez merged commit f217547 into c-jimenez:develop Jun 12, 2025
4 checks passed
@thomas-brunel thomas-brunel deleted the fix/wexitstatus-rvalue branch June 12, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants