utimens: validate futimens usage
authorEric Blake <ebb9@byu.net>
Tue, 6 Oct 2009 18:23:32 +0000 (12:23 -0600)
committerEric Blake <ebb9@byu.net>
Sat, 10 Oct 2009 14:28:00 +0000 (08:28 -0600)
commitd71f50566b9f00d9a325a08dff406f52d3f42195
treea24f6c62242778b65907d0c69394a52e3b1ea0e1
parent30dc6636ece9d1dbf8714f00c9758874733445a6
utimens: validate futimens usage

Using gl_futimens(fd,NULL,times) as an implementation for futimens
won't work unless we reliably detect EBADF for out-of-range fd.
Also catches a Linux bug with futimens(AT_FDCWD,NULL) changing ".".
mingw <utime.h> has a bug where utime's second argument is not const.

* lib/utimens.c (gl_futimens): Require valid fd up front, using
fewer syscalls on failure later on.  Avoid compiler warning on
mingw.
* modules/utimens (Depends-on): Add dup2.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/utimens.c
modules/utimens