diff options
author | Radek Podgorny <radek@podgorny.cz> | 2011-07-04 13:00:28 +0200 |
---|---|---|
committer | Radek Podgorny <radek@podgorny.cz> | 2011-07-04 13:00:28 +0200 |
commit | 30aa8be8211371130a50e010af2d4a612a2c6cde (patch) | |
tree | 27c97826126bfa70ffaaac8dbb850a695c5e4bc7 | |
parent | f6ac129d67cadd3571d679d621617028ccfb4a67 (diff) | |
download | unionfs-fuse-30aa8be8211371130a50e010af2d4a612a2c6cde.tar.gz |
Added patch by Sebastian Pipping to use utimensat() instead of utimes().
-rw-r--r-- | CREDITS | 1 | ||||
-rw-r--r-- | src/unionfs.c | 13 |
2 files changed, 5 insertions, 9 deletions
@@ -14,6 +14,7 @@ Jason Long <jlong@messiah.edu> Yann E. Morin <yann.morin.1998@anciens.enib.fr> Alexander Kolesen <kolesen.a@gmail.com> Pierre Jean Schweitzer <pierre.jean.schweitzer@cern.ch> +Sebastian Pipping <sebastian@pipping.org> Hashtable routines taken from: Christopher Clark <christopher.clark@cl.cam.ac.uk> diff --git a/src/unionfs.c b/src/unionfs.c index 56d50dc..f05af45 100644 --- a/src/unionfs.c +++ b/src/unionfs.c @@ -11,8 +11,8 @@ */ #ifdef linux - // For pread()/pwrite() - #define _XOPEN_SOURCE 500 + // For pread()/pwrite()/utimensat() + #define _XOPEN_SOURCE 700 #endif #include <fuse.h> @@ -22,6 +22,7 @@ #include <strings.h> #include <unistd.h> #include <fcntl.h> +#include <sys/stat.h> #include <dirent.h> #include <errno.h> #include <sys/types.h> @@ -656,13 +657,7 @@ static int unionfs_utimens(const char *path, const struct timespec ts[2]) { char p[PATHLEN_MAX]; snprintf(p, PATHLEN_MAX, "%s%s", uopt.branches[i].path, path); - struct timeval tv[2]; - tv[0].tv_sec = ts[0].tv_sec; - tv[0].tv_usec = ts[0].tv_nsec / 1000; - tv[1].tv_sec = ts[1].tv_sec; - tv[1].tv_usec = ts[1].tv_nsec / 1000; - - int res = utimes(p, tv); + int res = utimensat(0, p, ts, AT_SYMLINK_NOFOLLOW); if (res == -1) return -errno; |