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 non-functional error-check in cpucycles() #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Gnoxter
Copy link

@Gnoxter Gnoxter commented May 2, 2016

read() returns a ssize_t while sizeof() is a
size_t. Thus the ssize_t is promoted to an
unsigned integer. This leads to
misinterpreting a -1 returned by read()
on an error condition as successful read().

This commit fixes this by casting the sizeof()
to an ssize_t. Alternatively a == -1 check should
be sufficient as one would expect perf
to make the requested data available in proper size
or fail accordingly.

Signed-off-by: Gnoxter [email protected]

read() returns a ssize_t while sizeof() is a
size_t. Thus the ssize_t is promoted to an
unsigned integer. This leads to
misinterpreting a -1 returned by read()
on an error condition as successful read().

This commit fixes this by casting the sizeof()
to an ssize_t. Alternatively a == -1 check should
be sufficient as one would expect perf
to make the requested data available in proper size
or fail accordingly.

Signed-off-by: Gnoxter <[email protected]>
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.

1 participant