Currently you cannot handle a potential error of the close syscall on POSIX systems, and of the CloseHandle function on Windows. This means that you cannot reliably write to files, because the errors are also silently ignored.
The man page of close(2) specifically says:
Not checking the return value of close() is a common but nevertheless serious programming error. It is quite possible that errors on a previous write(2) operation are first reported at the final close(). Not checking the return value when closing the file may lead to silent loss of data. This can especially be observed with NFS and with disk quota. Note that the return value should be used only for diagnostics. In particular close() should not be retried after an EINTR since this may cause a reused descriptor from another thread to be closed.
I couldn't find specific information for Windows, but it hinted that CloseHandle might also fail to indicate an error.
I'd like to nominate this bug for 1.0, because this might need backward-incompatible changes to have "sound" support for file writing.
Currently you cannot handle a potential error of the
closesyscall on POSIX systems, and of theCloseHandlefunction on Windows. This means that you cannot reliably write to files, because the errors are also silently ignored.The man page of
close(2)specifically says:I couldn't find specific information for Windows, but it hinted that
CloseHandlemight also fail to indicate an error.I'd like to nominate this bug for 1.0, because this might need backward-incompatible changes to have "sound" support for file writing.