You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Currently you cannot handle a potential error of the
close
syscall on POSIX systems, and of theCloseHandle
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: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.
The text was updated successfully, but these errors were encountered: