8000 Fix error handling of getloadavg by mark-horvath-arm · Pull Request #1974 · google/benchmark · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix error handling of getloadavg #1974

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
Apr 29, 2025

Conversation

mark-horvath-arm
Copy link
Contributor

getloadavg returns with -1 if cannot obtain load average, but the current source casts the return value to size_t right away. The cast result for such a case is probably maximum unsigned long int, so the resizing of the res vector is certainly going to fail.

This change keeps the original return type of getloadavg and casts it just before the resizing of the res vector.

getloadavg returns with -1 if cannot obtain load average, but the
current source casts the return value to size_t right away. The cast
result for such a case is probably maximum unsigned long int, so the
resizing of the res vector is certainly going to fail.

This change keeps the original return type of getloadavg and casts it
just before the resizing of the res vector.
Copy link
Collaborator
@LebedevRI LebedevRI left a comment

Choose a reason for hiding this comment

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

LGTM

@LebedevRI LebedevRI merged commit 0e08459 into google:main Apr 29, 2025
84 checks passed
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
0