bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] [PATCH] paxutils: use POSIX interface for file time-setting


From: Paul Eggert
Subject: [Bug-tar] [PATCH] paxutils: use POSIX interface for file time-setting
Date: Tue, 14 Sep 2010 13:19:23 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100826 Thunderbird/3.0.7

This is a minor cleanup to use the POSIX.1-2008 interface for
setting file time stamps to nanosecond resolution, rather than
the pre-2008 gnulib interface.  On older hosts, it falls back
on gnulib's implementation of the POSIX interface.
* configure.ac: Don't check for utimes; it's not used.
* gnulib.modules: Add utimensat.
* tests/genfile.c: Don't include utimens.h.
(exec_checkpoint): Use POSIX utimensat function, not utimens.
---
 configure.ac    |    2 +-
 gnulib.modules  |    1 +
 tests/genfile.c |    3 +--
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index b2cca83..43985fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,7 +87,7 @@ PU_RMT
 PU_RTAPELIB
 PU_SYSTEM
 
-AC_CHECK_FUNCS(fsync lstat mkfifo readlink symlink setlocale utimes)
+AC_CHECK_FUNCS(fsync lstat mkfifo readlink symlink setlocale)
 AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
 AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
 
diff --git a/gnulib.modules b/gnulib.modules
index 8087498..fce4f7a 100644
--- a/gnulib.modules
+++ b/gnulib.modules
@@ -18,5 +18,6 @@ safe-read
 stdbool
 strerror
 strtol
+utimensat
 version-etc-fsf
 xalloc
diff --git a/tests/genfile.c b/tests/genfile.c
index 19cbdcb..998e6a6 100644
--- a/tests/genfile.c
+++ b/tests/genfile.c
@@ -29,7 +29,6 @@
 #include <argp.h>
 #include <argcv.h>
 #include <getdate.h>
-#include <utimens.h>
 #include <inttostr.h>
 #include <fcntl.h>
 #include <sys/stat.h>
@@ -656,7 +655,7 @@ exec_checkpoint (struct action *p)
        struct timespec ts[2];
 
        ts[0] = ts[1] = p->ts;
-       if (utimens (p->name, ts) != 0)
+       if (utimensat (AT_FDCWD, p->name, ts, 0) != 0)
          {
            error (0, errno, _("cannot set time on `%s'"), p->name);
            break;
-- 
1.7.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]