aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rw-r--r--example/fusexmp.c5
-rw-r--r--example/fusexmp_fh.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/example/fusexmp.c b/example/fusexmp.c
index 58b77a8..fa3fb4d 100644
--- a/example/fusexmp.c
+++ b/example/fusexmp.c
@@ -213,16 +213,19 @@ static int xmp_truncate(const char *path, off_t size)
return 0;
}
+#ifdef HAVE_UTIMENSAT
static int xmp_utimens(const char *path, const struct timespec ts[2])
{
int res;
+ /* don't use utime/utimes since they follow symlinks */
res = utimensat(0, path, ts, AT_SYMLINK_NOFOLLOW);
if (res == -1)
return -errno;
return 0;
}
+#endif
static int xmp_open(const char *path, struct fuse_file_info *fi)
{
@@ -359,7 +362,9 @@ static struct fuse_operations xmp_oper = {
.chmod = xmp_chmod,
.chown = xmp_chown,
.truncate = xmp_truncate,
+#ifdef HAVE_UTIMENSAT
.utimens = xmp_utimens,
+#endif
.open = xmp_open,
.read = xmp_read,
.write = xmp_write,
diff --git a/example/fusexmp_fh.c b/example/fusexmp_fh.c
index 046185c..57053ca 100644
--- a/example/fusexmp_fh.c
+++ b/example/fusexmp_fh.c
@@ -283,16 +283,19 @@ static int xmp_ftruncate(const char *path, off_t size,
return 0;
}
+#ifdef HAVE_UTIMENSAT
static int xmp_utimens(const char *path, const struct timespec ts[2])
{
int res;
+ /* don't use utime/utimes since they follow symlinks */
res = utimensat(0, path, ts, AT_SYMLINK_NOFOLLOW);
if (res == -1)
return -errno;
return 0;
}
+#endif
static int xmp_create(const char *path, mode_t mode, struct fuse_file_info *fi)
{
@@ -513,7 +516,9 @@ static struct fuse_operations xmp_oper = {
.chown = xmp_chown,
.truncate = xmp_truncate,
.ftruncate = xmp_ftruncate,
+#ifdef HAVE_UTIMENSAT
.utimens = xmp_utimens,
+#endif
.create = xmp_create,
.open = xmp_open,
.read = xmp_read,