X-Git-Url: https://git.cworth.org/git?p=tar;a=blobdiff_plain;f=gnu%2Futimens.c;fp=gnu%2Futimens.c;h=0cf26714b165dd6d2f41203ee94c69b520c9087a;hp=8ce10d104874144165ba7a1b8d446431352a177a;hb=ee168310ec4227174ace489bf5f81f8c2f91cde0;hpb=22f1eb8bc17e5be72dd23d42d6aaa60196ac22e6 diff --git a/gnu/utimens.c b/gnu/utimens.c index 8ce10d1..0cf2671 100644 --- a/gnu/utimens.c +++ b/gnu/utimens.c @@ -166,7 +166,7 @@ update_timespec (struct stat const *statbuf, struct timespec *ts[2]) Return 0 on success, -1 (setting errno) on failure. */ int -fdutimens (char const *file, int fd, struct timespec const timespec[2]) +fdutimens (int fd, char const *file, struct timespec const timespec[2]) { struct timespec adjusted_timespec[2]; struct timespec *ts = timespec ? adjusted_timespec : NULL; @@ -302,7 +302,7 @@ fdutimens (char const *file, int fd, struct timespec const timespec[2]) { #if HAVE_FUTIMESAT || HAVE_WORKING_UTIMES struct timeval timeval[2]; - struct timeval const *t; + struct timeval *t; if (ts) { timeval[0].tv_sec = ts[0].tv_sec; @@ -372,28 +372,12 @@ fdutimens (char const *file, int fd, struct timespec const timespec[2]) } } -/* Set the access and modification time stamps of FD (a.k.a. FILE) to be - TIMESPEC[0] and TIMESPEC[1], respectively. - FD must be either negative -- in which case it is ignored -- - or a file descriptor that is open on FILE. - If FD is nonnegative, then FILE can be NULL, which means - 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. - Return 0 on success, -1 (setting errno) on failure. */ - -int -gl_futimens (int fd, char const *file, struct timespec const timespec[2]) -{ - return fdutimens (file, fd, timespec); -} - /* Set the access and modification time stamps of FILE to be TIMESPEC[0] and TIMESPEC[1], respectively. */ int utimens (char const *file, struct timespec const timespec[2]) { - return fdutimens (file, -1, timespec); + return fdutimens (-1, file, timespec); } /* Set the access and modification time stamps of FILE to be @@ -419,7 +403,7 @@ lutimens (char const *file, struct timespec const timespec[2]) /* The Linux kernel did not support symlink timestamps until utimensat, in version 2.6.22, so we don't need to mimic - gl_futimens' worry about buggy NFS clients. But we do have to + fdutimens' worry about buggy NFS clients. But we do have to worry about bogus return values. */ #if HAVE_UTIMENSAT @@ -486,7 +470,7 @@ lutimens (char const *file, struct timespec const timespec[2]) #if HAVE_LUTIMES && !HAVE_UTIMENSAT { struct timeval timeval[2]; - struct timeval const *t; + struct timeval *t; int result; if (ts) { @@ -509,7 +493,7 @@ lutimens (char const *file, struct timespec const timespec[2]) if (!(adjustment_needed || REPLACE_FUNC_STAT_FILE) && lstat (file, &st)) return -1; if (!S_ISLNK (st.st_mode)) - return fdutimens (file, -1, ts); + return fdutimens (-1, file, ts); errno = ENOSYS; return -1; }