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

src/drive.c uses fread(3) like it’s read(2) #3

Open
eschaton opened this issue Jun 24, 2016 · 0 comments
Open

src/drive.c uses fread(3) like it’s read(2) #3

eschaton opened this issue Jun 24, 2016 · 0 comments

Comments

@eschaton
Copy link

The code in src/drive.c that calls fread(3) treats its return (a size_t) as if it were the return from read(2) (a ssize_t).

For fread(3) the return value will never be negative. Instead, any time the return value is less than the amount requested, you need to check for both failure and EOF using ferror(3) and feof(3) respectively.

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

No branches or pull requests

1 participant