+2011-07-02 Sebastian Pipping <sebastian@pipping.org>
+
+ * Make xmp_utimens of examples "fusexmp" and "fusexmp_fh"
+ not follow symlinks as other layers do that already.
+
2011-06-02 Miklos Szeredi <miklos@szeredi.hu>
* Add "remember" option. This works similar to "noforget" except
/*
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.
#endif
#ifdef linux
-/* For pread()/pwrite() */
-#define _XOPEN_SOURCE 500
+/* For pread()/pwrite()/utimensat() */
+#define _XOPEN_SOURCE 700
#endif
#include <fuse.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
+#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#include <sys/time.h>
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;
/*
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.
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
+#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#include <sys/time.h>
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;