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
fread(a, b, 0, c) bug #52
Comments
@steffengutmann Do you need fix for this ported to ABIv0 as well? |
Absolutely. But please note that I am not developing for AROS, just making my SW available for AROS. And I have already worked-around this problem in my SW. But I would not be surprised if other SW also runs into this same bug. |
Ok, understood. The fix will make it to ABIv0 but it will take some time before it is included in distributions. |
That sounds good to me!
…On Thu, Jan 13, 2022 at 9:20 AM deadw00d ***@***.***> wrote:
Ok, understood. The fix will make it to ABIv0 but it will take some time
before it is included in distributions.
—
Reply to this email directly, view it on GitHub
<#52 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZ4H7QJ74FSDEFO2BV3NATUV4CWLANCNFSM5K6RG44A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Fixed in 1d67ef5 |
A call to fread(buffer, size, 0, file) sets the EOF flag of the file descriptor. This is because of how AROS/compiler/posixc/fread.c (https://github.com/aros-development-team/AROS/blob/master/compiler/posixc/fread.c) is implemented:
Code: [Select]
The fix would be to change the condition to "else if (cnt < nblocks)" only, or do an early return 0 similar to how it is done in AROS/compiler/stdc/fread.c
Of course, it is easy to work around this by simply not calling fread when there is nothing to be read.
Attached is a test case including how to reproduce and the output on Linux and AROS.
fread.c.txt
The text was updated successfully, but these errors were encountered: