POSIX programmers: open() may fail if you are not allowed to, read() and write()...

@niconiconi@mk.absturztau.be

POSIX programmers: open() may fail if you are not allowed to, read() and write() can fail if the I/O is bad or if the kernel does you a EINTR, but close() rarely fails.

NFS: Hello.

POSIX programmers: What, close() can fail when the storage fails? OK, I'll just keep closing it until it succeeds!

Linux System Calls Manual: Retrying the close() after a failure return is the wrong thing to do, since this may cause a reused file descriptor from another thread to be closed. This can occur because the Linux kernel always releases the file descriptor early in the close operation, freeing it for reuse; the steps that may return an error, such as flushing data to the filesystem or device, occur only later in the close operation.