X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ffdutimensat.c;h=d226638f75c919e1412c572e4a03235271a16983;hb=2bbd4523187af328f114150c97847f7fb915ac82;hp=77f893bb3b05ff25ffa117aff9142c13561afdb0;hpb=9ea0943bfd68afa3412a139fa1a29d9b6c046916;p=gnulib.git diff --git a/lib/fdutimensat.c b/lib/fdutimensat.c index 77f893bb3..d226638f7 100644 --- a/lib/fdutimensat.c +++ b/lib/fdutimensat.c @@ -1,6 +1,6 @@ /* Set file access and modification times. - Copyright (C) 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -35,29 +35,17 @@ use just futimes (or equivalent) instead of utimes (or equivalent), and fail if on an old system without futimes (or equivalent). If TIMESPEC is null, set the time stamps to the current time. - ATFLAG must be 0 if FD is non-negative; otherwise it may be - AT_SYMLINK_NOFOLLOW to operate on FILE as a symlink. + ATFLAG is passed to utimensat if FD is negative or futimens was + unsupported, which can allow operation on FILE as a symlink. Return 0 on success, -1 (setting errno) on failure. */ int -fdutimensat (int dir, char const *file, int fd, struct timespec const ts[2], +fdutimensat (int fd, int dir, char const *file, struct timespec const ts[2], int atflag) { int result = 1; - if (atflag & ~AT_SYMLINK_NOFOLLOW) - { - errno = EINVAL; - return -1; - } if (0 <= fd) - { - if (atflag) - { - errno = EINVAL; - return -1; - } - result = futimens (fd, ts); - } + result = futimens (fd, ts); if (file && (fd < 0 || (result == -1 && errno == ENOSYS))) result = utimensat (dir, file, ts, atflag); if (result == 1)