]> Dogcows Code - chaz/tar/commitdiff
tar: switch to gnulib fdutimensat module
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 17 Sep 2010 21:23:24 +0000 (14:23 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 17 Sep 2010 21:24:04 +0000 (14:24 -0700)
* gnulib.modules: Add fdutimensat.
* src/common.h (fd_utimensat): Remove decl.
* src/extract.c (set_stat): Call fdutimensat, not fd_utimensat.
* src/misc.c (set_file_atime): Likewise.
(fd_utimensat): Remove.

gnulib.modules
src/common.h
src/extract.c
src/misc.c

index c6ded15f1170397ff605fdc03d126a9663f68613..957d06589ee32d18cd0f3baea04baa3fcf9cee66 100644 (file)
@@ -13,6 +13,7 @@ error
 exclude
 exitfail
 fdopendir
+fdutimensat
 fileblocks
 fnmatch-gnu
 fseeko
index d0e348465de49bb9af73391c1bff71a207090be4..2bc1d712ba22e6875e9d886b59982e9c31dec874 100644 (file)
@@ -612,8 +612,6 @@ bool maybe_backup_file (const char *file_name, bool this_is_the_archive);
 void undo_last_backup (void);
 
 int deref_stat (bool deref, char const *name, struct stat *buf);
-int fd_utimensat (int fd, int parentfd, char const *file,
-                 struct timespec const ts[2], int atflag);
 
 extern int chdir_current;
 int chdir_arg (char const *dir);
index 46ee6781fc8a8e96b0742d07b15c9e5326e52c6d..29967e4c78869e12965e08e94462cabfdebd2128 100644 (file)
@@ -324,7 +324,7 @@ set_stat (char const *file_name,
        ts[0].tv_nsec = UTIME_OMIT;
       ts[1] = st->mtime;
 
-      if (fd_utimensat (fd, AT_FDCWD, file_name, ts, atflag) == 0)
+      if (fdutimensat (fd, AT_FDCWD, file_name, ts, atflag) == 0)
        {
          if (incremental_option)
            check_time (file_name, ts[0]);
index f1ebdd4970ae3671fa82ee92d8ae06e3a943bb68..ca2921b0e0e6ad597f8967c41a40df3efcf92140 100644 (file)
@@ -613,21 +613,6 @@ deref_stat (bool deref, char const *name, struct stat *buf)
   return deref ? stat (name, buf) : lstat (name, buf);
 }
 
-/* Use futimens if possible, utimensat otherwise.  */
-int
-fd_utimensat (int fd, int parentfd, char const *file,
-             struct timespec const ts[2], int atflag)
-{
-  if (0 <= fd)
-    {
-      int result = futimens (fd, ts);
-      if (! (result < 0 && errno == ENOSYS))
-       return result;
-    }
-
-  return utimensat (parentfd, file, ts, atflag);
-}
-
 /* Set FD's (i.e., assuming the working directory is PARENTFD, FILE's)
    access time to ATIME.  ATFLAG controls symbolic-link following, in
    the style of openat.  */
@@ -638,7 +623,7 @@ set_file_atime (int fd, int parentfd, char const *file, struct timespec atime,
   struct timespec ts[2];
   ts[0] = atime;
   ts[1].tv_nsec = UTIME_OMIT;
-  return fd_utimensat (fd, parentfd, file, ts, atflag);
+  return fdutimensat (fd, parentfd, file, ts, atflag);
 }
 
 /* A description of a working directory.  */
This page took 0.023837 seconds and 4 git commands to generate.