Paul Eggert <address@hidden> wrote:
> Jim Meyering <address@hidden> writes:
>
>> Your switch statement should probably handle EBADF, too,
>> to avoid an unnecessary utimes call after such a failure.
>
> EBADF shouldn't happen as it violates the futimens documentation,
> which says "FD must be either negative -- in which case it is ignored
> -- or a file descriptor that is open on FILE.", and the code in
> question is reachable only if FD is nonnegative. I omitted a test for
> EBADF because I figured that there's no point optimizing cases that
> shouldn't happen.
Fair enough.
The only other question is whether EROFS is always defined. This code
now contains the first use of that symbol in coreutils. I checked a few
packages and found that the uses in binutils and cvs are both protected
with #if directives. But rsync and openssh use it unconditionally,
so it's probably ok, these days.