"Laurent Bercot" <[email protected]> wrote: > If you are in the rare case where you need to check the return code from > close(), then you should probably use close() directly, not a wrapper > around it.
I wouldn't go quite that far--I'd say a wrapper to handle EINTR is useful in either case--but I agree that it's worth thinking carefully about which errors, if any, are worth failing for in any given case, rather than failing for everything. Mainly I'd fail for EIO on close(), just as on write(). But in some cases, we can know that EIO is impossible, or can be caught later. Say, if we never did any writing, or if we're closing a dup'ed descriptor for a file that's still open. After checking over my own code, I've found several cases like that. I've got my own wrapper now for the cases where I want to detect EIO.
