Details
Description
Multiple functions e.g., in stout ignore the return value of ::close with the following rationale,
// We ignore the return value of close(). This is because users // calling this function are interested in the return value of // write(). Also an unsuccessful close() doesn't affect the write.
I believe this is incorrect in general. Especially when not calling ::fsync after a write operation, the kernel might buffer writes and only trigger write-related failures when the file descriptor is closed, see e.g., the note on error handling here.
We should audit our code to make sure that failures to ::close file descriptors are properly propagated when needed.