-
Notifications
You must be signed in to change notification settings - Fork 16
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
stdio/file: fix numerous issues in the fread/fwrite functions #376
base: master
Are you sure you want to change the base?
Conversation
Also fixed error handling in blocking safe read to always return -1 on error. JIRA: RTOS-892, RTOS-874
Fixed fread function issues: - non-blocking fread was not supported - unbuffered read was not setting F_ERROR on read errors - unbuffered read was not setting F_EOF at the end-of-file - unbuffered read was dropping bytes on EAGAIN - buffered read was not setting F_ERROR when refilling the buffer - buffered read was dropping bytes on EAGAIN - buffered read was incorrectly setting F_EOF on EAGAIN Fixed fwrite function issues: - interleaved fread/fwrite functions weren't working for Unix sockets (caused by an unnecessary seek trigerring an error) - fwrite was returning 0 when read buffer discarding failed due to seek errors JIRA: RTOS-892
bf2a36e
to
7058c9c
Compare
@@ -101,18 +101,26 @@ ssize_t __safe_read(int fd, void *buf, size_t size) | |||
continue; | |||
} | |||
else { | |||
break; | |||
return -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also fixed error handling in blocking safe read to always return -1 on error.
How is this different? The else
branch is taken when rlen < 0
, so if (rlen < 0)
below is still executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right - disregard this comment.
Description
Motivation and Context
Types of changes
How Has This Been Tested?
Checklist:
Special treatment