diff options
author | Sebastian Pipping <sebastian@pipping.org> | 2011-06-25 19:14:29 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2011-07-04 13:01:35 +0200 |
commit | c605b5f73c458eeacdb6653e6899b5ebe7f1fc1a (patch) | |
tree | 9aa6d860f0ec90b54fcffe5a47fa439df9f8b434 /example/fusexmp.c | |
parent | fe16912e9b9466a5a167c962e745d5690459f099 (diff) | |
download | libfuse-c605b5f73c458eeacdb6653e6899b5ebe7f1fc1a.tar.gz |
utimens must not follow symlinks
Make xmp_utimens of examples "fusexmp" and "fusexmp_fh" not follow
symlinks as other layers do that already.
Diffstat (limited to 'example/fusexmp.c')
-rw-r--r-- | example/fusexmp.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/example/fusexmp.c b/example/fusexmp.c index 083bbea..58b77a8 100644 --- a/example/fusexmp.c +++ b/example/fusexmp.c @@ -1,6 +1,7 @@ /* FUSE: Filesystem in Userspace Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu> + Copyright (C) 2011 Sebastian Pipping <sebastian@pipping.org> This program can be distributed under the terms of the GNU GPL. See the file COPYING. @@ -15,8 +16,8 @@ #endif #ifdef linux -/* For pread()/pwrite() */ -#define _XOPEN_SOURCE 500 +/* For pread()/pwrite()/utimensat() */ +#define _XOPEN_SOURCE 700 #endif #include <fuse.h> @@ -24,6 +25,7 @@ #include <string.h> #include <unistd.h> #include <fcntl.h> +#include <sys/stat.h> #include <dirent.h> #include <errno.h> #include <sys/time.h> @@ -214,14 +216,8 @@ static int xmp_truncate(const char *path, off_t size) static int xmp_utimens(const char *path, const struct timespec ts[2]) { int res; - 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; - - res = utimes(path, tv); + res = utimensat(0, path, ts, AT_SYMLINK_NOFOLLOW); if (res == -1) return -errno; |