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: skip flushing read-only streams in file_close() and return 0 on success #77

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

MikloshXXX
Copy link

Previously, file_close() always attempted to flush the file buffer even if the file was opened in read-only mode, which caused errors when there was no data to write.
Additionally, it returned NULL instead of 0 on success.

This change adds a check to flush only when the _WRITE flag is set, and fixes the return value to 0 for a successful close.

@ohkimur ohkimur merged commit 7d7037d into ohkimur:main Feb 4, 2025
1 check passed
@ohkimur
Copy link
Owner

ohkimur commented Feb 4, 2025

@MikloshXXX Thanks for the contribution!

@MikloshXXX MikloshXXX deleted the fix-flushing branch February 5, 2025 04:06
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