Skip to content

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