summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2010-09-17 14:23:24 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2010-09-17 14:24:04 -0700
commit098ad10c71e87f8003227aa10ad8c88ae43dce12 (patch)
treee920dc129ff3eec00eb5e9290b1a29d76b245d16
parent6e08ab76949954eccd059db0d5da90e011a11c27 (diff)
downloadtar-098ad10c71e87f8003227aa10ad8c88ae43dce12.tar.gz
tar: switch to gnulib fdutimensat module
* 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.
-rw-r--r--gnulib.modules1
-rw-r--r--src/common.h2
-rw-r--r--src/extract.c2
-rw-r--r--src/misc.c17
4 files changed, 3 insertions, 19 deletions
diff --git a/gnulib.modules b/gnulib.modules
index c6ded15f..957d0658 100644
--- a/gnulib.modules
+++ b/gnulib.modules
@@ -13,6 +13,7 @@ error
exclude
exitfail
fdopendir
+fdutimensat
fileblocks
fnmatch-gnu
fseeko
diff --git a/src/common.h b/src/common.h
index d0e34846..2bc1d712 100644
--- a/src/common.h
+++ b/src/common.h
@@ -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);
diff --git a/src/extract.c b/src/extract.c
index 46ee6781..29967e4c 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -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]);
diff --git a/src/misc.c b/src/misc.c
index f1ebdd49..ca2921b0 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -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. */